Timestamp Value - please help
From: Richard (anonymous_at_discussions.microsoft.com)
Date: 05/02/04
- Next message: Richard: "RE: Difficult"
- Previous message: DalePres: "Re: Dataset question..."
- Next in thread: DalePres: "Re: Timestamp Value - please help"
- Reply: DalePres: "Re: Timestamp Value - please help"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 2 May 2004 14:46:02 -0700
I am using a class to store values from a query, but I have found no documentation to show how to capture the actual value of a timestamp from a SQL Server 2000 database table using VB.Net. I need to use the timestamp in the Where clause of an update statement, but the value returned is "System.Byte[]", not the actual value. Here is some of my code:
'Assume I've pulled these fields from table (TS is timestamp)
Select EmpID, FirstName, LastName, TS From Employees
Private mintEmpID As Integer
Private mstrFN As String
Private mstrLN As String
'I'm using a byte array to store the TS. Is that the right way to do it?
Private mbytTS(8) As Byte
'Here's my data.
With ds.Tables(0).Rows(0)
mintEmpID = .Item("EmpID")
mstrFN = .Item("FirstName")
mstrLN = .Item("LastName")
mbytTS = .Item("TS")
End With
When the user changes the data and saves, the update query using the TS in the Where clause fails because mbytTS reads 'System.Byte[]' instead of the actual timestamp.
Private sql as String
sql = "Update Employees Set FirstName='" & mstrFN & "', LastName='" & mstrLN & "' Where EmpID = " & mintEmpID & " And TS =" & mybtTS
I'm missing the key thing here, which is the actual timestamp value. Can someone please tell me how to capture the timestamp into a variable, and reference it correctly in the update query? Thank you in advance for your help.
- Next message: Richard: "RE: Difficult"
- Previous message: DalePres: "Re: Dataset question..."
- Next in thread: DalePres: "Re: Timestamp Value - please help"
- Reply: DalePres: "Re: Timestamp Value - please help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|