数据库连接问题,现场给分
我有一段脚本:
<html>
<head>
<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>
<%strname=request("name")%>
<%straddress=request("address")%>
<%strdate_y=request("date_y")%>
<%strdate_m=request("date_m")%>
<%strdate_d=request("date_d")%>
<%strdate=strdate_y&"-"&strdate_m&"-"&strdate_d%>
<%strusername=request("username")%>
<%strpassword=request("password")%>
<%
Set conn = Server.CreateObject("ADODB.Connection")
ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=test.mdb;DefaultDir=" & Server.MapPath(".") & ";DriverId=25;FIL=MS Access;MaxBufferSize=512;PageTimeout=5"
conn.Open ConnectionString
%><body>
<%Set rs = Server.CreateObject("ADODB.Recordset")
SqlStr = "SELECT * FROM user where username='"&strusername&"'"
rs.Open SqlStr,conn,1,1
if rs.recordcount=1 then
response.write "你的用户名已经存在!请换用户名<br>"
response.write "<a href=javascript:window.history.back()>返回</a>"
elseif rs.recordcount=0 then
call addnew()
end if%>
<%sub addnew()%>
<%Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.Open "user", conn, adOpenDynamic, 3
rs1.AddNew
rs1("name") = strname
rs1("address") = straddress
rs1("birthday") = strdate
rs1("username") = strusername
rs1("password") = strpassword
rs1.Update//这里出错
response.write "已成功录入!!"%>
<%end sub%>
</body>
</html>
在有些机器上可以正常运行,但有些机器上在 rs1.Update处出错。
谁能帮我解决?