日期:2014-05-17 浏览次数:21286 次
<%@ Language=VBScript %> <html> <head> <meta http-equiv="Content-Language" content="zh-cn"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>New Page 1</title> </head> <body> <p>test ADO 更新语句</p> <% tvid = request("tvid") pwd = request("pwd") if tvid<>"" then Set Conn=Server.CreateObject("ADODB.Connection") Conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"&_ "Data Source="& Server.MapPath("userinfo.mdb") Conn.Open Set RS=Server.CreateObject("ADODB.Recordset") sql="select*from userinfo where tvid='"&tvid&"'" rs.open sql,conn,1,1 set rs1=server.createobject("ADODB.Recordset") if rs.EOF or rs.bof then rs1.Open "userinfo",conn,1,2 rs1.addnew array("tvid","pwd"), array(tvid,pwd) Response.Write "New user added: " + tvid + "(" + pwd + ")" else DateAndTime = getDate() 'Response.Write "aaa=" + DateAndTime sql1="Update userinfo set logtime=""" + DateAndTime + """ where tvid=""" + tvid + """" 'Response.Write sql1 rs1.open sql1,conn,1,2 rs1.close '问题在这句,注释掉这句网页就不出错了。 set rs1=nothing end if rs.close set rs=nothing set conn=nothing end if %> <% function getDate() getDate=year(now)&"-"&month(now)&"-"&day(now)&" "&hour(now)&":"&minute(now)&":"&second(now) end function %> </body> </html>
sql1 = "Update userinfo set logtime='" & DateAndTime & "' where tvid='" & tvid & "'" conn.execute sql1
------解决方案--------------------
[color=#FF0000]sql="select*from userinfo where tvid='"&tvid&"'"[/color]