M
mazunini
Unregistered / Unconfirmed
GUEST, unregistred user!
有如下asp代码,目的是将输入的内容保存到sql2000中
listserver数据库中的listserver表中,我用iis将该
asp网页发布后输入数据,web页显示成功,但打开sql2000
数据库发现数据并没有真正录入,请问这是怎么回事??
(已经在slq2000和odbc中配置过,用户设置为hueyan,
密码1234,并测试通过!)
该表字段有username、userpassword、userlevel、
useremail、userfullname、useraddress、userphone.
asp代码如下:
<HTML>
<HEAD><TITLE>订阅电子报</TITLE></HEAD>
<% On Error Resume Next
Dim strDBDSN, strFullName, strEmail, strPhone, strUserName
Dim strAddress, strUserPassword, strSQL, objDBConn
strDBDSN="DSN=ListServer;UID=hueyan;PWD=1234"
If Request.Form <> "" then
strFullName = Request.Form("FullName")
strAddress = Request.Form("Address")
strEmail = Request.Form("Email")
strPhone = Request.Form("Phone")
strUserName = Request.Form("UserName")
strUserPassword=request.form("Password")
strSQL = "INSERT INTO ListUsers (UserName,UserPassword,UserEmail,UserFullName,UserAddress,UserPhone) "
strSQL = strSQL &
"VALUES ('" &
strUserName &
"','"
strSQL = strSQL &
strUserPassword &
"','"
strSQL = strSQL &
strEmail &
"','"
strSQL = strSQL &
strFullName &
"','"
strSQL = strSQL &
strAddress &
"','"
strSQL = strSQL &
strPhone &
"')"
Set objDBConn = Server.CreateObject("ADODB.Connection")
objDBConn.Open strDBDSN
objDBConn.Execute strSQL
If objDBConn.Errors.Count > 0 then
strMessage = "数据库发生错误: " &
strSQL &
"<P>"
else
strMessage = "<P>" &
strFullName &
"已经成功的注册电子报</P>"
End If
objDBConn.Close
Set objDBConn = Nothing
End If %>
<BODY bgcolor="#FFFFFF">
<CENTER>
<FORM action = "SQLSubscribeMail.asp" method="POST">
<P align="center"><B>请输入使用者的资料订阅电子报</B></P><HR>
<%=strMessage %>
<TABLE border=1>
<TR><TD>全名:</TD>
<TD><INPUT TYPE="TEXT" NAME="FullName" size ="10"></TD>
</TR><TR>
<TD>使用者帐号:</TD>
<TD><INPUT TYPE="TEXT" NAME="UserName" size="10"></TD>
</TR><TR>
<TD>使用者密码:</TD>
<TD><Input TYPE="PASSWORD" NAME="Password" size="10"></TD>
</TR><TR>
<TD>地址:</TD>
<TD><INPUT TYPE="TEXT" NAME="Address" size="30"></TD>
</TR><TR>
<TD>电话:</TD>
<TD><INPUT TYPE="TEXT" NAME="Phone" size="12"></TD>
</TR><TR>
<TD>电子邮件地址:</TD>
<TD><INPUT TYPE="TEXT" NAME="Email" size="20"></TD>
</TR><TR>
<TD colspan=2 align=center><INPUT TYPE="SUBMIT" value="订阅电子报"></TD>
</TR>
</TABLE><HR>
</FORM></CENTER>
</BODY></HTML>
listserver数据库中的listserver表中,我用iis将该
asp网页发布后输入数据,web页显示成功,但打开sql2000
数据库发现数据并没有真正录入,请问这是怎么回事??
(已经在slq2000和odbc中配置过,用户设置为hueyan,
密码1234,并测试通过!)
该表字段有username、userpassword、userlevel、
useremail、userfullname、useraddress、userphone.
asp代码如下:
<HTML>
<HEAD><TITLE>订阅电子报</TITLE></HEAD>
<% On Error Resume Next
Dim strDBDSN, strFullName, strEmail, strPhone, strUserName
Dim strAddress, strUserPassword, strSQL, objDBConn
strDBDSN="DSN=ListServer;UID=hueyan;PWD=1234"
If Request.Form <> "" then
strFullName = Request.Form("FullName")
strAddress = Request.Form("Address")
strEmail = Request.Form("Email")
strPhone = Request.Form("Phone")
strUserName = Request.Form("UserName")
strUserPassword=request.form("Password")
strSQL = "INSERT INTO ListUsers (UserName,UserPassword,UserEmail,UserFullName,UserAddress,UserPhone) "
strSQL = strSQL &
"VALUES ('" &
strUserName &
"','"
strSQL = strSQL &
strUserPassword &
"','"
strSQL = strSQL &
strEmail &
"','"
strSQL = strSQL &
strFullName &
"','"
strSQL = strSQL &
strAddress &
"','"
strSQL = strSQL &
strPhone &
"')"
Set objDBConn = Server.CreateObject("ADODB.Connection")
objDBConn.Open strDBDSN
objDBConn.Execute strSQL
If objDBConn.Errors.Count > 0 then
strMessage = "数据库发生错误: " &
strSQL &
"<P>"
else
strMessage = "<P>" &
strFullName &
"已经成功的注册电子报</P>"
End If
objDBConn.Close
Set objDBConn = Nothing
End If %>
<BODY bgcolor="#FFFFFF">
<CENTER>
<FORM action = "SQLSubscribeMail.asp" method="POST">
<P align="center"><B>请输入使用者的资料订阅电子报</B></P><HR>
<%=strMessage %>
<TABLE border=1>
<TR><TD>全名:</TD>
<TD><INPUT TYPE="TEXT" NAME="FullName" size ="10"></TD>
</TR><TR>
<TD>使用者帐号:</TD>
<TD><INPUT TYPE="TEXT" NAME="UserName" size="10"></TD>
</TR><TR>
<TD>使用者密码:</TD>
<TD><Input TYPE="PASSWORD" NAME="Password" size="10"></TD>
</TR><TR>
<TD>地址:</TD>
<TD><INPUT TYPE="TEXT" NAME="Address" size="30"></TD>
</TR><TR>
<TD>电话:</TD>
<TD><INPUT TYPE="TEXT" NAME="Phone" size="12"></TD>
</TR><TR>
<TD>电子邮件地址:</TD>
<TD><INPUT TYPE="TEXT" NAME="Email" size="20"></TD>
</TR><TR>
<TD colspan=2 align=center><INPUT TYPE="SUBMIT" value="订阅电子报"></TD>
</TR>
</TABLE><HR>
</FORM></CENTER>
</BODY></HTML>
代码: