问题描述
测试我在sql server 2005数据库中创建的用户日志表的功能。 userlog表有5列logid(int),username(varchar),logintime(varchar),logouttime(varchar)和date(varchar)。 logid,用户名和& logintime插入成功,但是当我从我的vb应用程序中单击logout时出现上述错误。 17出现在我的错误中,因为我在退出时的系统时间实际上是17:57:33,LogOutTime的当前值是17:57:33
Am testing out the funtionality of a userlog table i''ve created in sql server 2005 database. The userlog table has 5 columns logid(int), username(varchar), logintime(varchar), logouttime(varchar), and date(varchar). logid,username, & logintime insert successfully but i get the above error when i click logout from my vb application. The 17 appears in my error because my system time at logout was actually 17:57:33, the current value of LogOutTime is 17:57:33
Function UserLoginTime(Username As String, LoginTime As Date) As Integer
If Rs.State = adStateOpen Then Rs.Close
sql = " Select * From Userlog"
Rs.Open sql, RSconn
With Rs
.AddNew
!Username = Username
!LoginTime = LoginTime
.Update
End With
UserLoginTime = Rs(0).Value
End Function
Function UserLogoutTime(Index As Integer, LogOutTime As String) As Integer
If Rs.State = adStateOpen Then Rs.Close
sql = " Update Userlog set Userlog.LogoutTime=#" & LogOutTime & "# Where (userlog.logid)= " & Index & ""
Rs.Open sql, RSconn
End Function
Sub DisplayUserLog(lstLog As ListView, mDate As Date)
Dim lstItem As ListItem, a As Integer
If Rs.State = adStateOpen Then Rs.Close
sql = " Select * From Userlog Where (Userlog.Date)=#" & mDate & "#"
Rs.Open sql, RSconn
lstLog.ListItems.Clear
Do While Not Rs.EOF
a = a + 1
Set lstItem = lstLog.ListItems.Add(, , a)
lstItem.SubItems(1) = Rs(1).Value
lstItem.SubItems(2) = Rs(2).Value
If IsNull(Rs(3).Value) Then
lstItem.SubItems(3) = ""
Else
lstItem.SubItems(3) = Rs(3).Value
End If
lstItem.SubItems(4) = Rs(4).Value
Rs.MoveNext
Loop
End Sub
推荐答案
这篇关于运行时错误'-2147217900(80040e14)':'#17附近的语法不正确'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!