G
Guest
1. I've a column in a log table in my SQL Server that's of SmallDateTime
datatype. This column (LogonTime) stores the particular Time, e.g. 12:00:00,
that the user logs on. I created a class called SystemLog and 1 of its
attribute is called LogonTime. I wish to represent values that LogonTime
column by this LogonTime attribute. What should this attribute's datatype be?
DateTime?
2. I've another column called LastUpdate in every column. This column is of
rowversion type. I've this column to prevent Concurrency problem. I'll check
if values of this LastUpdate columns are the same before and during updates.
Again, I'll like to represent it in a class. This is how I declare it:
Private _LastUpdate(8) As Byte
Public Sub New(ByVal newUserID As String, ByVal newPassword As String, ByVal
newLastUpdate() As Byte)
_UserID = newUserID
_Password = newPassword
Dim n As Integer
For n = 0 To 7
_LastUpdate(n) = newLastUpdate(n)
Next n
End Sub
Public Property LastUpdate() As Array
Get
Return _LastUpdate
End Get
Set(ByVal Value As Array)
Dim n As Integer
For n = 0 To 7
_LastUpdate(n) = Value(n)
Next n
End Set
End Property
Is this fine or are there better methods?
3. Say if I want to execute a SQL Select query statement, and I want to
parse the value every column of each row to a variable in my codes, how
should I do?
Dim strConnection as String = "server=(local);database=myDatabase;User
Id=sa;password=;"
Dim strSQL as string = "SELECT * FROM Users;"
Dim objDataSet As New DataSet()
Dim objConnection As New SqlConnection(strConnection)
Dim objDataAdapter As New SqlDataAdapter(strSQL, objConnectionj)
objDataAdapter.Fill(objDataSet, "Users")
then?
Sorry I'm a beginner... please help. Thank you.
datatype. This column (LogonTime) stores the particular Time, e.g. 12:00:00,
that the user logs on. I created a class called SystemLog and 1 of its
attribute is called LogonTime. I wish to represent values that LogonTime
column by this LogonTime attribute. What should this attribute's datatype be?
DateTime?
2. I've another column called LastUpdate in every column. This column is of
rowversion type. I've this column to prevent Concurrency problem. I'll check
if values of this LastUpdate columns are the same before and during updates.
Again, I'll like to represent it in a class. This is how I declare it:
Private _LastUpdate(8) As Byte
Public Sub New(ByVal newUserID As String, ByVal newPassword As String, ByVal
newLastUpdate() As Byte)
_UserID = newUserID
_Password = newPassword
Dim n As Integer
For n = 0 To 7
_LastUpdate(n) = newLastUpdate(n)
Next n
End Sub
Public Property LastUpdate() As Array
Get
Return _LastUpdate
End Get
Set(ByVal Value As Array)
Dim n As Integer
For n = 0 To 7
_LastUpdate(n) = Value(n)
Next n
End Set
End Property
Is this fine or are there better methods?
3. Say if I want to execute a SQL Select query statement, and I want to
parse the value every column of each row to a variable in my codes, how
should I do?
Dim strConnection as String = "server=(local);database=myDatabase;User
Id=sa;password=;"
Dim strSQL as string = "SELECT * FROM Users;"
Dim objDataSet As New DataSet()
Dim objConnection As New SqlConnection(strConnection)
Dim objDataAdapter As New SqlDataAdapter(strSQL, objConnectionj)
objDataAdapter.Fill(objDataSet, "Users")
then?
Sorry I'm a beginner... please help. Thank you.