Timestamp

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


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



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)
  • java.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver
    ... Trying to connect to an SQL Server 2000 database using MS SQL JDBC. ... import java.*; public class Connect{private java.sql.Connection con = null; ... private final String serverName= "localhost"; ...
    (comp.lang.java.help)
  • Timestamp Value - please help
    ... Private mintEmpID As Integer ... Private mstrFN As String ... 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. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to check if IIS and SQL Server is installed on server?
    ... for SQL Server, you could test this registry key: ... Private Declare Function RegCloseKey _ ... ' tests pour IIS ... Private Function FolderExists(ByRef sFolder As String) As Boolean ...
    (microsoft.public.vb.6.webdevelopment)
  • Re: How to check if IIS and SQL Server is installed on server?
    ... for SQL Server, you could test this registry key: ... Private Declare Function RegCloseKey _ ... ' tests pour IIS ... Private Function FolderExists(ByRef sFolder As String) As Boolean ...
    (microsoft.public.vb.general.discussion)

Loading