hey!

I'm trying to capture the user that has logged on my PC by using windows services. The problem is that they dont send the info to me dB. what is wrong with the code below??


Protected Overrides Sub Onstart
Dim myNewLog As New EventLog
myNewLog.Log = "Security"

username = entry.UserName.ToString.Split("\\")(1).Trim()
logCode = entry.EventID
timeLog = entry.TimeWritten.ToShortTimeString().Split(" ")(0).Trim()
dateLog = entry.TimeWritten.ToShortDateString()
If (logCode = 528) Then
strSQL = " INSERT INTO tableName" _
& " VALUES ('" & username & "','" & timeLog & "','" & dateLog & "')"

'insert into table
Call ADDInfo(strSQL.ToString)
End If
End Sub


--------------------------------------------------

Protected Overrides Sub OnStop
Dim myNewLog As New EventLog
myNewLog.Log = "Security"

Dim cnn As SqlConnection = New SqlConnection(cnnString.ToString)
Dim cmd As SqlCommand = New SqlCommand

username = entry.UserName.ToString.Split("\\")(1).Trim()
logCode = entry.EventID
timeLog = entry.TimeWritten.ToShortTimeString().Split(" ")(0).Trim()
dateLog = entry.TimeWritten.ToShortDateString()
If logCode = 538 Then
strSQL = " INSERT INTO TableName " _
& " VALUES ('" & username & "','" & timeLog & "','" & dateLog & "')"
Call ADDInfo(strSQL.ToString)
End If
End Sub


--------------------------------------------------

i even have the installers that are fine. but it just doesnt want to store the info.

Please Help