Full Date Value Not Being Written Via JDBC - Any Ideas?
Feb 8, 2007
Hi,
I'm trying to write a java.sql.Date to a database and the minutes/
seconds etc. are not being written. I've seen and tested many
examples
found via searches and still have come up with nothing. Here's what I
have:
java.sql.Date formation - recommended constructor forms:
java.sql.Date entryDttm = new
java.sql.Date(System.currentTimeMillis());
OR
java.sql.Date entryDttm = new java.sql.Date(new
java.util.Date().getTime());
// prepared statement insert
pstmt.setDate(1, entryDttm);
// what is written to database
2007-02-07 12:00:00.000
// what needs to be written
2007-02-08 09:37:25.793
The above date value is written when I insert using the SQL method
GETDATE()
The field is stored in a MS SQL Server 8.0 database and is defined as
a 'datatime' or 'smalldatetime' field.
How can I replicate the results of GETDATE() into 'datetime' and
'smalldatetime' fields in
a MS-SQL Server database (or is it possible?). Would a timestamp
datatype make more sense?
I'm using MS_SQL Server JDBC drivers.
Any advice would be GREATLY appreciated!
View 2 Replies
ADVERTISEMENT
Apr 10, 2008
Hi All,
I am having an issue with a JDBC based reporting tool when connected to my SQL2005 db. Basically I am getting erradic results. Let me explain the two cases.
1) The full result set gets returned. This is good. In my trace file, I can see the cursor getting created and chunks of 50 records returning to the program. The last chunk has 10 records in it (a total of 960 records).
2) Partial results returned. 10 records, which is strangely enough the last chunk size of the full result set. No errors are flagged.
The vendor of the product ensures me that they cannot replicate the problem (even given my db), and I am having trouble identifying places/settings in SQL2005 that might help.
If it makes a difference, the dataset is a query with many LEFT OUTER JOINS, but the problem seems to stem from the inclusion of a subquery which uses a function in its from clause. EG.
Code Snippet
SELECT blah1, blah2
FROM table1 LEFT OUTER JOIN table2 ON ....
...
WHERE EXISTS (SELECT id FROM func1(2,2) WHERE id = blah1)
If I remove the EXISTS clause, things seem to work well.
My @@version = Microsoft SQL Server 2005 - 9.00.2050.00 (Intel X86) Feb 13 2007 23:02:48 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)
Any help with this would be GREATLY appreciated.
Thanks,
Steele.
View 4 Replies
View Related
Feb 25, 2008
Hello !
I would like to add a day to a static date, something like this :
SELECT
dbo.Answer.ID
FROM
dbo.Answer
where answer.moment > '20080224'+1
[where '20080224' is a date : 24th of fébrurary 2008]
Looks bizzare, but I need it for a more complex query.
Thanks a lot for any help !
my favorit hoster is ASPnix : www.aspnix.com !
View 4 Replies
View Related
Jul 20, 2005
I am writing a datetime field value to MS SQL Server 7 in the following mannervia a stored procedure:// item to be written is originally a java.util.Date objectjava.util.Date fromDate;// I'm inserting it here into the databasecstmt.setTimestamp(8, new Timestamp(fromDate.getTime()));// the record in the database appears as follows - as I wanted it to..12/23/2004 4:30:43 AMThe problem is reading the date FROM the database back into ANY type of JavaDate-related object. No matter what I try, the hour/minutes/seconds are notreturned, and I desperately need the hour and minutes. I don't want to storethe hours and minutes in another field - it just causes more complications.Does anyone out there know a way to get the ENTIRE date value out of the database?
View 4 Replies
View Related
Oct 11, 2007
Is there an estimated release date for the JDBC driver version 1.2. Currently this is only a Technology preview which is not to be used in production. My problen is that we can no longer distribute SQL 2000 as part of our ISV agreement after Dec 31st and The current released version JDBC 1.1 has a issue with JBOSS startup which is corrected in 1.2.
View 1 Replies
View Related
Apr 14, 2008
I have read similar posts to this, but I am still having problems.
I am trying to use connection pooling to connect to a local SQL Server 2005 database. I am running my application using
MyEclipse Enterprise Workbench. I have verified that sqljdbc.jar resides in "WebRoot/WEB-INF/lib/"
"WebRoot/WEB-INF/web.xml":
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsichemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<resource-ref>
<res-ref-name>jdbc/DefaultDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
"WebRoot/META-INFcontext.xml":
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/DefaultDS"
auth="Container"
type="javax.sql.DataSource"
username="tec"
password="tec"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDrive"
url="jdbcqlserver://localhost:1433/tec;databaseName=tec;user=tec;password=test;"
validationQuery="select 1"
maxActive="10"
maxIdle="2"/>
</Context>
Classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.genuitec.eclipse.j2eedt.core.J2EE14_CONTAINER"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jaxen-full.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jaxp-api.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jdbc2_0-stdext.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/sqljdbc.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jstl.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/sax.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/saxpath.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/standard.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xalan.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xercesImpl.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
Code to connect:
import java.io.Serializable;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public int testConnect(){
Connection conn = null;
InitialContext ctx = null;
java.sql.Statement stmt = null;
try {
ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/DefaultDS");/*This is generating the Cannot load JDBC driver class... error*/
conn = ds.getConnection();
stmt = conn.createStatement();
return CONSTANT.SUCCESS;
} catch (Exception e) {
return CONSTANT.FAILURE;
}finally {
try {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
if (ctx != null)
ctx.close();
} catch (Exception ex) {
// do nothing
return CONSTANT.FAILURE;
}
}
}
Any ideas would be greatly appreciated.
View 17 Replies
View Related
Dec 6, 2006
Hi,
We are trying to move our application from SQL2005 to SQL2005, we are using 2005 jdbc driver 1.1.
The problem we have is, when a date is retrieved from the database, only the year part got correctly, but the date is automatically set to January 1 of that year. The interesting thing is this problem doesn't occur on local development environment (developer's windows platform), it only happens when we deploy the application to production server (unix).
Does anyone know what is going on, how to fix it?
Thanks.
Cathie
View 12 Replies
View Related
Aug 8, 2006
Hi all,
We've just stumbled on a 1.0 version incompatibility with the JDBC specs.
Problem: A table with SMALLINT column. According to JDBC specs version 3.0
(p.B-179) and 4.0 (p.221)), the value should be converted to Integer type.
Unfortunatelly we get a Short object :(
Now, I remember, this case was also affecting old JSQLConnect driver from
DataDirect. Could that problem sneak to new MS driver too?
Please let me know any resolution to this problem if exists.
The issue has not been fixed in CTP 1.1 version. Any ideas if it can be fixed??
Cheers,
Piotr
View 1 Replies
View Related
Mar 12, 2008
I've got an import app written in Java. One table I'm importing from contains 22 million records. When I run the app in a 2000 environment, I have my max heap set at 512, and the table gets imported. When I run in a 2005 environment, I have to change the max heap to 1152 or it will error out with a similiar error:
com.microsoft.sqlserver.jdbc.SQLServerException: The system is out of memory. Use server side cursors for large result sets:Java heap space. Result set size:854,269,999. JVM total memory size:1,065,484,288. (<--this is with max heap at 1024)
what is the difference between the 2000 and 2005 JDBC that I have to set max heap in one and not the other?
View 3 Replies
View Related
Jun 15, 2015
I have a table with 3000 values and What I need to do is place a full set of these values for every date in the year 2015. How to achieve this through SSIS?I know we can achieve through SQL using while loop.
EG: 1-1-2015 a b c d
1-2-2015 a b c d like wise 12-31-2015 a b c d .
How to create the package.
View 8 Replies
View Related
Dec 18, 2007
I'm having a database insertion problem. I make an entry to my registration form, write it to the database; then the next registration entry displays an error that the same UID can't be written to the database. I don't know where to start tracing this, but here is the stored procedure I use and some of the code that might generate it.
@UserName nvarchar(128), @Email nvarchar(50), @FirstName nvarchar(25), @LastName nvarchar(50), @Teacher nvarchar(25), @GradYr int DECLARE @UserID uniqueidentifier SELECT @UserID = NULL SELECT @UserID = UserId FROM dbo.aspnet_Users WHERE LOWER(@UserName) = LoweredUserName
INSERT INTO [table name](UserID,UserName,Email,FirstName,LastName,Teacher,GradYr) VALUES (@UserID,@UserName,@Email,@FirstName,@LastName,@Teacher,@GradYr) Protected Sub cuwCreateUserWizard1_CreatingUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles cuwCreateUserWizard1.CreatedUser strEmail = CType(cuwCreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Email"), TextBox).Text strUserName = CType(cuwCreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"), TextBox).Text.ToLower strFirstName = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtFirstName"), TextBox).Text strLastName = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtLastName"), TextBox).Text lngGradYr = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtGradYr"), TextBox).Text strTeacher = CType(cuwCreateUserWizard1.CreateUserStep.CustomNavigationTemplateContainer.FindControl("txtTeacher"), TextBox).Text End Sub Protected Sub cuwCreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles cuwCreateUserWizard1.CreatedUser Dim cmd As New SqlCommand("sp_CreateUser", con) cmd.CommandType = Data.CommandType.StoredProcedure cmd.Parameters.AddWithValue("@UserName", strUserName) cmd.Parameters.AddWithValue("@Email", strEmail) cmd.Parameters.AddWithValue("@FirstName", strFirstName) cmd.Parameters.AddWithValue("@LastName", strLastName) cmd.Parameters.AddWithValue("@Teacher", strTeacher) cmd.Parameters.AddWithValue("@GradYr", lngGradYr) Using con con.Open() cmd.ExecuteScalar() con.Close() End Using cmd.Equals(Nothing) End Sub
Please let me know if any other info is needed to help determine what's wrong.
View 8 Replies
View Related
Oct 6, 1998
Hi,
i have following problem:
I have a DB with 4 tables in MSSQL6.5. In those tables write an NT service (4 threads for each table) 24h/day. I want to know somehow when i have no write in one of those tables for more than 1-2 hours (i dont want to querry those tables everytimes). MSSQL6.5 offer this kind of facilities? Or I can do this using stored procedures or something else?
Thank you very much,
Sebastian Bologescu
View 1 Replies
View Related
Dec 31, 2005
I am very new to SQL server and I'm using stored procedures for my program. So far I wrote one tonight, that works just fine.
I haven't really written one before, but its kind of similar syntax since I know C++/C# and VB.
My question is, even though this works for what I need it do, is it written correctly? Can you see any problems with it, or would you have done it differently?
I want to make sure its done correctly, and it runs as fast as possible.
Thanks!
[pre]
CREATE PROCEDURE CreateNewUser
@UserID int out, @LoginID nvarchar(30), @Password nvarchar(30), @RegisterDate smalldatetime, @LoginIDExists nvarchar(30)AS /* Check to see if the loginID is already in use before attempting to save it. We MUST have a unique loginID for each user */ SELECT @LoginIDExists = loginID FROM users WHERE loginID = @LoginID
/* If we pulled a value from the database, then the loginID already exists, return with error code 1 */ IF (@LoginIDExists = @LoginID) BEGIN SELECT 1 RETURN END
ELSE BEGIN /* The loginID does not already exist, attemp to add the new user to the database. */ INSERT INTO users ( loginID, loginpassword, registerDate ) VALUES ( @LoginID, @Password, @RegisterDate )
/* Grab the UserID for the new user. */ SELECT @UserID = @@identity
/* return with error code 0 */ SELECT 0 RETURN ENDGO
[/pre]
View 6 Replies
View Related
Oct 12, 1999
I'm wondering if anyone has a written project plan for upgrading a server to 7.0 from 6.5.
I'm looking to make this upgrade myself shortly. I would appreciate any dialog, or a written
working plan. Thanks,
Mark Blackburn o `"._ _ M onterey
mark@mbari.org o / _ |||;._/ ) B ay
Science at its Best! ~ _/@ @ /// ( ~ A quarium
(831) 775-1880 ( (`__, ,`| R esearch
http://www.mbari.org/ '.\_/ |\_.' I nstitute
Database Administrator
MBARI Personal Web Page: http://www.mbari.org/~mark/
View 1 Replies
View Related
Aug 27, 2002
If someone can tell me if this script run with sql2000 it would be great.
Thanks in advance.
SELECT "Date du traitement :" = getdate()
go
print 'ORDRE DE TRI '
print '----------------------'
go
EXEC SP_HELPSORT
GO
print ' '
print 'VERSION'
print '-------------'
print ' '
go
SELECT @@VERSION
GO
print ' '
print 'CONFIGURATION DU SERVEUR '
print '----------------------------------------------'
print ' '
go
EXEC SP_CONFIGURE
GO
print ' '
print 'LISTE DES BASES SQL'
print '---------------------------------'
print ' '
go
EXEC SP_HELPDB
GO
PRINT " "
PRINT " "
PRINT 'LISTE DES DEVICES'
PRINT '-----------------'
PRINT " "
EXEC SP_HELPdevice
PRINT " "
GO
DECLARE @cmd NVARCHAR (300)
DECLARE @cmd1 NVARCHAR (300)
DECLARE @cmd2 NVARCHAR (300)
DECLARE @cmd3 NVARCHAR (300)
DECLARE @dbid INT
DECLARE @MaxId INT
DECLARE @dbName SYSNAME
SET @MaxId = (SELECT MAX(dbid) FROM MASTER.dbo.sysdatabases)
SET @dbid = 1
print " "
print " "
print'DETAIL DE CHAQUE BASE 'print" "print" "
WHILE @dbid <= @MaxId
BEGIN
SET @dbName = (SELECT name FROM MASTER.dbo.sysdatabases WHERE dbid = @dbid)
IF (@dbname IS NOT NULL)
BEGIN
select @cmd3 ='DETAIL DE LA BASE ' + @dbname
print @cmd3
PRINT '************************************************* ********************************************'
print ' '
select @cmd = 'use ' + quotename(@dbname) + ' exec sp_helpfile'
exec (@cmd)
print ' '
print ' '
print 'UTILISATEUR DE LA BASE '+ RTRIM(@dbname)
print '************************************************* ******** '
print ' '
select @cmd1 = 'use ' + quotename(@dbname) + ' exec sp_helpuser'
exec (@cmd1)
PRINT ' '
print ' '
print 'DROITS POUR LES OBJETS DE LA BASE '+ RTRIM(@dbname)
print '************************************************* ******** '
print ' '
select @cmd2 = 'use ' + quotename(@dbname) + ' exec sp_helprotect'
exec (@cmd2)
SET @dbid = @dbid + 1
END
ELSE
SET @dbid = @dbid + 1
print " "
print " "
END
View 1 Replies
View Related
Apr 25, 2006
I have a transaction table which has Date as datetime field, amount and account number. i want to find out count of checks that were written in a period of 4 days which exceeded i.e. > $400, between 401 and 500, > 501 for a single month. the table has data for more than a year and i want the results then grouped in monthly format like in
OCT between 300 & 400 #30 (30 customers gave checks total worth $300-$400 within any 4 consecutive days period in the month of OCT )
between 400 & 500 # 20
> 501 # 10
NOV between 300 & 400 #30
between 400 & 500 # 20
> 501 # 10
and so on for a 6 month period.
View 1 Replies
View Related
Apr 26, 2006
Hi there!
I've a table with a nvarchar(max) column on Filegroup2. While inserting a lot of big datas (Word documents, each 2.5MB), the primary filegroup is growing - but the Filegroup2 remains still on its creation size.
Is that a bug? By the way, i ve dropped the table and recreated on the other filegroup, after that i've restartet the SQL 2005 Service.
Someone experience?
Thanks, Torsten
View 1 Replies
View Related
Feb 27, 2007
Hey guys, I had purchased a program that generates full operational asp.net pages from an access db. I was unfamiliar with the language, and so that was the route I took. After disecting it and studying I've learned a bit and made it work in my environment. However, I now need to migrate everything over to mssql. I got the db portion down and now I'm trying to modify my scripts to point to a sql db rather than an access db. I thought it was going to be relatively simple but it's proving to be quite a challenge for me.Was wondering if anyone could check my work.
The original access driven page had the following connection strings.vb page had [ public strConn as string="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("../") & "/db/db.mdb"end class]and in my aspx. pages I hadAccessDataSourceControl1.selectcommand="SELECT * FROM table "AccessDataSourceControl1.ConnectionString = strConn
My new page now has the following.I got rid of the .vb page and put this in.
Dim myConnection as New SqlConnection("Server=mysqlserver;Database=db;UID=myusername;PWD=my pw;")
Const strSQL as String ="SELECT * FROM table"
Dim myCommand as New SqlCommand(strSQL, myConnection)
further down I have a wmx data grid. I'm assuming I don't need to touch that but there is a line that has,
<wmx:AccessDataSourceControl id="AccessDataSourceControl1" runat="server" ></wmx:AccessDataSourceControl>
and I don't know what the equivilant of that is. I know its pointing to the accessdatasoucrcontrol1 that has the select command, but what would be the equivilant ofwmx:accessdatasourcecontrol?Also, is this the way to go? by that i mean, should I just rescript everything? Also,
1) Am I connecting to the sql db properly? 2) some sites say I have to put a connection string in the web.config file, is that true?3) Does any one have any references I can goto, I'm having some trouble finding a good article that lays down exactly what needs to go where in an sql asp.net environment.
Thanks guys.
View 2 Replies
View Related
Feb 27, 2008
I added one crummy column to my table. I updated the stored procedure and added the thing to the aspx page which is my form for adding an article. I have a strong feeling that something is foul over here...Why is it that Visual Studio will not allow me to capitalize the word get and when I delete the () after ShortDesc they immediatlye reappear and the get statement is set to get. Every other one of them, and there are 9 others use GET and there is no () after the public property variable name. Does anyone know the reason for this?
Public Property Author As System.String
GETReturn _Author
End Get Set(ByVal Value As System.String)
_Author= ValueEnd Set
End PropertyPublic Property ShortDesc() As System.String
GetReturn _ShortDesc
End GetSet(ByVal value As System.String)
End Set
End Property
View 1 Replies
View Related
Oct 22, 1998
I am beginning to write stored procedures for an application which is to be written in VB5. The stored procedures will be written in 6.5 but when the system goes live, we hope to upgrade to SQL server 7
What I want to know is what changes will I have to make to the stored procedures when I upgrade to 7.0?
View 4 Replies
View Related
Feb 23, 2004
I've created an alias of my computer name
with the Network client utility
Computer name : SCG59730
Instance name : Mercure
Alias : MyProject
When I try to register this new server (MyProjectMercure)
SQL Server doesn't find the server
View 2 Replies
View Related
Oct 16, 2006
I have a 3 data flows with an oledb source, a script component and a sql server destination that reports success and that it wrote the rows to the table in question. However, the rows are not written to the SQL Server 2005 table that is the destination. I have many other data flows in the same package that work exactly the same way that insert the rows they should insert in the destination table.
An example of the message I get indicating success is as follows:
[DTS.Pipeline] Information: "component "SQL Server Destination" (75)" wrote 289 rows.
Has anyone else seen this behavior or have an idea what might be wrong? Why would the data flow report success when the rows were not, in fact, inserted in the destination table?
View 3 Replies
View Related
Nov 14, 2006
Hello,
We're trying to launch a SSIS package throw a webservice. This WebService loads a configuration file with "myPackage.ImportConfigurationFile(pathConfig)" and assigns values to some variables with "myPackage.Variables.Item(Parameters.Keys.Item(i)).Value = Parameters.Item(i)". Seems to work.
I we execute the webmethod of the WebService, this works but only when we execute first time, the SSIS finished succesfully. But when we execute a second time the Webmethod, we've a lot of failure with messages:
The result of the expression "@[User::Email]" on property "ToLine" cannot be written to the property. The expression was evaluated, but cannot be set on the property.The result of the expression ""The Import of " + @[User::ExcelFile]+ " is successful"" on property "MessageSource" cannot be written to the property. The expression was evaluated, but cannot be set on the property.
Thx for your help
View 1 Replies
View Related
Mar 25, 2008
Hi guys,
acutally i have setup a Disaster Recovery plan for my database.. i m taking a full back once in a week,. i dont' know when i right click on the job and trying to check the view history option to check when was last backup has been taken, it's showing nothing..but when i check on acutall location the backup was taken there.. i don't know y it's not writing any info in view history table.. or is it clear once in a week and i cann't see that...
Can any one tell's me about this...
View 3 Replies
View Related
Sep 26, 2006
ok. the problem: some tables are empty, so i can't be sure why some are updating at the DB and some arent.
I have manually picked thru every line of the xml that i'm reading into the dataset here, and it is fine, data is all valid and everything.
the tables i'm most worried about are bulletins and surveys, but they all have to be imported from my upload, the code steps thru just fine and I've been thru it a million times. Did I miss something in my dataadapter configuration?. 'daBulletin ' Me.daBulletin.ContinueUpdateOnError = True Me.daBulletin.DeleteCommand = Me.SqlDeleteCommand17 Me.daBulletin.InsertCommand = Me.SqlInsertCommand17 Me.daBulletin.SelectCommand = Me.SqlSelectCommand25 Me.daBulletin.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "tblBulletin", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("BulletinID", "BulletinID"), New System.Data.Common.DataColumnMapping("ContractID", "ContractID"), New System.Data.Common.DataColumnMapping("Msg_Type", "Msg_Type"), New System.Data.Common.DataColumnMapping("DatePosted", "DatePosted"), New System.Data.Common.DataColumnMapping("Subject", "Subject"), New System.Data.Common.DataColumnMapping("B_Body", "B_Body"), New System.Data.Common.DataColumnMapping("I_Read_It", "I_Read_It"), New System.Data.Common.DataColumnMapping("DateRead", "DateRead")})}) Me.daBulletin.UpdateCommand = Me.SqlUpdateCommand16
here is my merge function: Private Function Merge(ByVal sFilename As String, ByVal User As String) As String
Dim connMerge As New SqlConnection(ConnectionString)
Dim dsNew As New dsBeetleTracks
Dim dsExisting As New dsBeetleTracks
Dim strResult As String
SetConnections(connMerge)
Dim idc As New System.Security.Principal.GenericIdentity(User)
Dim currentUser As BeetleUser = bu
dsNew.ReadXml(sFilename)
If currentUser.IsInRole("Admin") Or currentUser.IsInRole("QA") Then
If dsNew.tblBulletin.Count > 0 Then
daBulletin.Fill(dsExisting.tblBulletin)
dsExisting.Merge(dsNew.tblBulletin)
strResult += daHelipads.Update(dsExisting.tblBulletin).ToString + " Bulletins updated<br>"
End If
End If
If dsNew.tblHours.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("Admin")) Then
daHours.Fill(dsExisting.tblHours)
dsExisting.Merge(dsNew.tblHours)
strResult += daHours.Update(dsExisting.tblHours).ToString + " hours updated<br>"
End If
If dsNew.tblHeliPads.Count > 0 Then
daHelipads.Fill(dsExisting.tblHeliPads)
dsExisting.Merge(dsNew.tblHeliPads)
strResult += daHelipads.Update(dsExisting.tblHeliPads).ToString & " helipads updated "
End If
If dsNew.tblExpenses.Count > 0 Then
daExpenses.Fill(dsExisting.tblExpenses)
dsExisting.Merge(dsNew.tblExpenses)
strResult += daExpenses.Update(dsExisting.tblExpenses).ToString + " expenses updated<br>"
End If
If dsNew.tblPersons.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn")) Then
daPersons.Fill(dsExisting.tblPersons)
dsExisting.Merge(dsNew.tblPersons)
strResult += daPersons.Update(dsExisting.tblPersons).ToString + " persons updated<br>"
End If
If currentUser.IsInRole("Field") Then
daSurveys.SelectCommand.CommandText = "exec Surveys_Field_Select"
daSurveys.InsertCommand.CommandText = "exec Surveys_Field_Insert"
daSurveys.UpdateCommand.CommandText = "exec Surveys_Field_Update"
End If
If dsNew.tblSurveys.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("Field")) Then ' Or CurrentUser.IsInRole("Admin")) Then
daSurveys.Fill(dsExisting.tblSurveys)
dsExisting.Merge(dsNew.tblSurveys)
strResult += daSurveys.Update(dsExisting.tblSurveys).ToString + " surveys updated<br>"
End If
If dsNew.tblSurveyChecks.Count > 0 And (currentUser.IsInRole("QA") Or currentUser.IsInRole("Admin")) Then
daSurveyChecks.Fill(dsExisting.tblSurveyChecks)
dsExisting.Merge(dsNew.tblSurveyChecks)
strResult += daSurveyChecks.Update(dsExisting.tblSurveyChecks).ToString + " survey checks updated<br>"
End If
If dsNew.tblTreatments.Count > 0 And (currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn")) Then ' Or CurrentUser.IsInRole("Admin")) Then
daTreatments.Fill(dsExisting.tblTreatments)
dsExisting.Merge(dsNew.tblTreatments)
strResult += daTreatments.Update(dsExisting.tblTreatments).ToString + " treatments updated<br>"
End If
If dsNew.tblInternalQC.Count > 0 And (currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn") Or currentUser.IsInRole("Survey")) Then ' Or CurrentUser.IsInRole("Admin")) Then
daInternalQC.Fill(dsExisting.tblInternalQC)
dsExisting.Merge(dsNew.tblInternalQC)
strResult += daInternalQC.Update(dsExisting.tblInternalQC).ToString + " internalqc updated<br>"
End If
If dsNew.tblTreatmentChecks.Count > 0 And (currentUser.IsInRole("QA") Or currentUser.IsInRole("Admin")) Then
Try
daTreatmentChecks.Fill(dsExisting.tblTreatmentChecks)
dsExisting.Merge(dsNew.tblTreatmentChecks)
strResult += daTreatmentChecks.Update(dsExisting.tblTreatmentChecks).ToString + " treatment checks updated<br>"
Catch dbex As DBConcurrencyException
strResult += vbCrLf & dbex.Message
For x As Integer = 0 To dbex.Row.Table.Columns.Count - 1
strResult += vbCrLf & dbex.Row.GetColumnError(x)
Next
End Try
End If
If dsNew.tblHeliPiles.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then ' Or CurrentUser.IsInRole("Planner")CurrentUser.IsInRole("QA") Or CurrentUser.IsInRole("Admin") Or
daHeliPiles.Fill(dsExisting.tblHeliPiles)
dsExisting.Merge(dsNew.tblHeliPiles)
strResult += daHeliPiles.Update(dsExisting.tblHeliPiles).ToString + " piles updated<br>"
End If
If dsNew.tblHeliCycles.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then ' CurrentUser.IsInRole("Planner") Or Or CurrentUser.IsInRole("Admin")) Then
daHeliCycles.Fill(dsExisting.tblHeliCycles)
dsExisting.Merge(dsNew.tblHeliCycles)
strResult += daHeliCycles.Update(dsExisting.tblHeliCycles).ToString + " cycles updated<br>"
End If
If dsNew.tblHeliTurns.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then 'CurrentUser.IsInRole("Admin") Or CurrentUser.IsInRole("Planner") Or
daHeliTurns.Fill(dsExisting.tblHeliTurns)
dsExisting.Merge(dsNew.tblHeliTurns)
strResult += daHeliTurns.Update(dsExisting.tblHeliTurns).ToString + " turns updated<br>"
End If
If dsExisting.HasChanges Then
dsExisting.Merge(dsNew)
End If
dsExisting.AcceptChanges()
'duh.
'If dsNew.HasChanges Then
' dsNew.AcceptChanges()
'End If
If dsExisting.HasErrors Then
Dim bolError As Boolean
Dim tempDataTable As DataTable
bolError = True
strResult += "<br>"
For Each tempDataTable In dsExisting.Tables
If (tempDataTable.HasErrors) Then
strResult += PrintRowErrs(tempDataTable)
End If
Next
End If
dsNew.Dispose()
dsExisting.Dispose()
connMerge.Close()
'edebugging will only track strresult
Dim fsError As New FileStream(Server.MapPath("./incoming/error.txt"), FileMode.Create, FileAccess.Write)
Dim swError As New StreamWriter(fsError)
swError.WriteLine("--==ERROR LOG==--")
swError.WriteLine(Now.Date.ToShortDateString)
swError.WriteLine("-----------------")
swError.WriteLine(strResult)
swError.Close()
fsError.Close()
Return strResult
End Function
View 2 Replies
View Related
Jul 3, 2007
SS 2005 64Bit SP2 Hello Chaps Intermittent problem with the SQL Agent job history not getting written to the history table. Background:Today we noticed the account SQL Agent runs under cropping up in sp_who2. A quick check of the activity monitor said nothing was running. We ran a trace and, based on the SQL being executed, had a word with one of the developers who confirmed they had manually executed one of the jobs. There was no record anywhere that the job had run. There has been an issue with this particular job, when executed by this user, not showing up in history before but, as mentioned, this had been intermittent and we thought that a restart of the service had sorted it. Stuff run to try to track the job:EXEC sp_help_jobactivity @job_name = 'MyJob' EXEC sp_help_jobhistory @job_name = 'MyJob' SELECT *FROM dbo.sysjobhistory WHERE job_id = 'MyJob GUID'The first returned a row with no details in the columns indicating activity (e.g. last_executed_step_date and other columns were null). sp_help_jobhistory had some historical records but nothing since mid last month. sysjobhistory correlated with sp_help_jobhistory as you would expect. Right clicking the job in SSMS and viewing history correlated with sp_help_jobhistory (i.e. some records but nothing since mid-June). We edited the SQL in the job step and got the developer to rerun the job and, typically, everything appeared as it should in all the above result sets.Obviously this is tricky to track down since it has been intermittent but does anyone recognise anything that I have described above? I have of course googled but there doesn't really seem to be anything about it. We have considered there may be a problem in MSDB and may try running CHECKDB to see if anything comes up but somehow I doubt it will. Ta!
View 7 Replies
View Related
Oct 15, 2007
I added the subquery and now this thing consistently takes more than five minutes to return 7100+ rows. Any suggestions? Thanks again, you guys are the best.
ddave
----------------------------
SET @StrQry1 = '(SELECT 1 AS Counter, Q1.SubsidyLevel, VEL.*
FROM dbo.ViewEligibilityPHC VEL
LEFT OUTER JOIN (SELECT *
FROM dbo.MEMB_LISHISTS l
WHERE l.LISThruDate is null
AND l.Deleted = ''0'') AS Q1 ON VEL.MEMBID = Q1.MemberID
WHERE VEL.OPTHRUDT is null
AND VEL.OPT LIKE ''' + @HPlan + ''' AND (VEL.PCP IS NULL OR VEL.PCP LIKE ''' + @Prvdr + ''')
AND VEL.HCC LIKE ''' + @HCC + ''' AND (VEL.CaseMgrID IS NULL OR VEL.CaseMgrID LIKE ''' + @CaseMngr + ''')
AND VEL.OPFROMDT <= CAST(''' + @SDate + ''' AS datetime)
AND ISNULL(VEL.OPTHRUDT, CAST(''' + @TDate + ''' AS datetime)) >= CAST(''' + @EDate + ''' AS datetime)) '
View 12 Replies
View Related
Mar 9, 2004
does anybody know, is there any possible way to connect to database written in Natural ?? After evaluating everyday backups on that database all i can see is BCK data format. im trying to create datawarehouse running on sql server 2000 and gather all operational data from the systems that are working in my firm. I just managed to get data originating from Interbase and these with dbf and txt format . unfortunatelly my problem with bck data format is still open.
As you can see im a beginner with that issue so if anybody could help i would be very gratefull.
View 1 Replies
View Related
Oct 15, 2006
How can I declare output parameter in stored procedure, written in C++/CLR?
In C# it is proc_name( out SqlInt32 value ).
In VB.NET it is proc_name( <Out()> ByRef value As SqlInt32 ).
And in C++ ?
Thanks a lot for support.
View 7 Replies
View Related
Aug 24, 2006
Hi,
I'm trying to add exernal functions defined by a third party in a dll. They developed the dll in Visual C++ and is provided as is, with very little additional info about the code. The dll is tested and can be integrated into an application developed with VB.NET but no other experiences are available. I tried to add the functions to SQL Server 2005 Express edition but on attempting to CREATE the ASSEMBLY i get the following error:
CREATE ASSEMBLY for assembly 'ThirdPartyDll' failed because assembly 'ThirdPartyDll' is malformed or not a pure .NET assembly.
Unverifiable PE Header/native stub.
No rows affected.
(0 row(s) returned)
@RETURN_VALUE = -6
Finished running [dbo].[ThirdPartyDll].
Is there an alternative way to add these functions for non pure .NET assemblies, or in general, is there a workaround to solve the problem?
By the way, do i need to register the dll with RegSvr32 first?
Thanks,
Marco.
View 1 Replies
View Related
Aug 29, 2006
where in sql server 2005 ( and 2000 for that matter) do i find the path to the location where backups are placed (.bak files)? is there sql i can use to find this out
View 6 Replies
View Related