新手求助:怎么更新数据库的数据?
DB= "./vote/database/VOTE.mdb "
Set objConn = Server.CreateObject( "ADODB.Connection ")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath(DB)
'打开数据库连接
objConn.Open
strSQL = "Select * From MEMBER Where NAME= ' " & UserName & " ' "
strSQL = strSQL & " And PASSWORD = ' " & UserPass & " ' "
Set objRS = Server.CreateObject( "ADODB.Recordset ")
objRS.Open strSQL, objConn, 1, 3
'是否存在这个用户
If NOT objRS.EOF Then
'更新登陆时间
** objRS.Update Array( "ZXTIME "), _
** Array(NOW())
小弟要实现的目的的用户登陆后,把用户的最新登陆时间更新,但上面的代码运行正常,没有出错提示.可是用户的最新登陆时间没有更新,把 "** "的两行代码改为下面两行还是和上面的一样
objRS( "ZXTIME ")=NOW()
objRS.Update
那位大虾帮帮忙!
------解决方案--------------------强烈建议使用SQL语句
Sql= "Select * From MEMBER Where NAME= ' " & UserName & " ' And PASSWORD = ' " & UserPass & " ' "
Set objRS=objConn.Execute(Sql)
If Not objRs.Eof Then
Sql= "Update MEMBER Set ZXTIME= ' "& Now() & " ' Where NAME= ' " & UserName & " ' "
End If
------解决方案--------------------If NOT objRS.EOF Then
objRS( "ZXTIME ")=NOW()
objRS.Update
end if