Timestamp Value - please help

From: Richard (anonymous_at_discussions.microsoft.com)
Date: 05/02/04


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.



Relevant Pages

  • Re: Timestamp Value - please help
    ... The following topic in MSDN gives an example of converting hex to string. ... Private mintEmpID As Integer ... 'Pass the timestamp to conversion function. ... I retrieve the updated TS for future updates. ...
    (microsoft.public.dotnet.framework.adonet)
  • Timestamp
    ... How do you get the actual value of a timestamp from a SQL Server 2000 database table using VB.Net? ... Private mintEmpID As Integer ... Private mstrFN As String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: [PHP] Unique Object Instance ID..?
    ... private static $INSTANCES = 0; ... combining the three makes a unique id; but it's only unique to that session, no good for a real world application as there could be 50 sessions all running at the same time on the server; and odds are rather high that two instances of the object could have the same id. ... I'd thought a simple random integer would possibly be enough (combined with the timestamp), but there could still be collission. ...
    (php.general)
  • Re: [PHP] Unique Object Instance ID..?
    ... private static $INSTANCES = 0; ... combining the three makes a unique id; but it's only unique to that session, ... I'd thought a simple random integer would possibly be enough (combined with ... the timestamp), but there could still be collission. ...
    (php.general)
  • Unique Object Instance ID..?
    ... private static $INSTANCES = 0; ... combining the three makes a unique id; but it's only unique to that session, no good for a real world application as there could be 50 sessions all running at the same time on the server; and odds are rather high that two instances of the object could have the same id. ... I'd thought a simple random integer would possibly be enough (combined with the timestamp), but there could still be collission. ...
    (php.general)