我写了一个社区的代码,但是总不能添加新用户。
我点击我注册网页上的发送按钮时,我连接到我的register.asp上显示注册用户的信息,总是出现错误,希望有人能帮我改一下代码。
代码如下:
<%
set conn=server.createobject("adodb.connection")
DBPath="Provider=Microsoft.Jet.OLEDB.4.0;" & Server.MapPath("../data/members.mdb")
conn.Open DBPath
if trim(request.form("Name"))="" or trim(request.form("psw"))="" or trim(request.form("E_mail"))="" then
%>
<%
else
set rstmp=server.createobject("adodb.recordset")
set rstmp=conn.execute("Select * from Users Where Name='"&trim(request.form("name")) & "'")
if not rstmp.eof then
response.write("错误:
用户名:"&request.form("Name")&"已经被别人使用,请使用其他用户名!
按此返回>>
")
else
str="Insert Into Users(Name,Sex,Psw,Email,City,Occupation,URL,Signature,Interests,OICQ,ICQ,PswNotice,PswItis) values('"
str=str & request.Form("name") & "','"
str=str & request.form("sex") & "','"
str=str & request.form("psw") & "','"
str=str & request.form("e_mail") & "','"
str=str & request.form("city") & "','"
str=str & request.form("occupation") & "','"
str=str & request.form("url") & "','"
str=str & request.form("Signature") & "','"
str=str & request.form("Interests") & "','"
str=str & request.form("oicq") & "','"
str=str & request.form("icq") & "','"
str=str & request.form("pswnotice") & "','"
str=str & request.form("pswitis") & "')"
conn.execute(str)
set rs=server.createobject("adodb.recordset")
set rs=conn.execute("Select * from Users Where name='"&request.form("name") & "'")
session.contents("UserName")=request.form("name")
%>
错误类型是:Provider (0x80040E4D)
/asp/shequ/register.asp, 第 4 行
如果我在系统中设置数据源
把第四行改为conn.open members
会出现一下错误:Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
/asp/shequ/register.asp, 第 32 行
请来人麻烦帮忙说说原因!
谢谢!