Timestamp
From: Richard (anonymous_at_discussions.microsoft.com)
Date: 05/01/04
- Next message: Larry: "save a XML file into a memo field in a access database"
- Previous message: Herfried K. Wagner [MVP]: "Re: F1 Thru F12"
- Next in thread: Herfried K. Wagner [MVP]: "Re: Timestamp"
- Reply: Herfried K. Wagner [MVP]: "Re: Timestamp"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 30 Apr 2004 18:46:02 -0700
How do you get the actual value of a timestamp from a SQL Server 2000 database table using VB.Net? I want to use it in the Where clause, but the value returned is "System.Byte[]". Here is 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() As Byte = New Byte() {0, 1, 2, 3, 4, 5, 6, 7}
'Assume my data is in a dataset.
With ds.Tables(0).Rows(0)
mintEmpID = .Item("EmpID")
mstrFN = .Item("FirstName")
mstrLN = .Item("LastName")
mbytTS = .Item("TS")
'Assume user changes data, and saves.
'An 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
- Next message: Larry: "save a XML file into a memo field in a access database"
- Previous message: Herfried K. Wagner [MVP]: "Re: F1 Thru F12"
- Next in thread: Herfried K. Wagner [MVP]: "Re: Timestamp"
- Reply: Herfried K. Wagner [MVP]: "Re: Timestamp"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|