《实例精粹ASP》中部分源代码
源代码在线查看: useraddsave.asp
dim IsModifyPwd, strPwd1, strPwd2, strAccount
dim strSQL, cmdObj, rsObj
IsModifyPwd = Request.Form("modifyPassword")
strAccount = RealString(Request.Form("userID"))
strPwd1 = RealString(Request.Form("password1"))
strPwd2 = RealString(Request.Form("password2"))
if strPwd1strPwd2 then
Response.Write "密码、确认密码不同返回"
Response.End
end if
strSQL = "SELECT * FROM Admins WHERE Account = '"& strAccount &"'"
'Response.Write strSQL
'Response.End
set rsObj = conn.execute (strSQL)
if not rsObj.eof then
Response.Write "该用户名已存在返回"
Response.End
end if
Set cmdObj = Server.CreateObject("ADODB.Command")
Set rsObj = Server.CreateObject("ADODB.RecordSet")
cmdObj.CommandText = "SELECT * FROM Admins WHERE (name is null)"
cmdObj.CommandType = adCmdText
Set cmdObj.ActiveConnection = conn
rsObj.Open cmdObj, , adOpenKeyset, adLockOptimistic
rsObj.AddNew
rsObj("Account") = strAccount
rsObj("name") = Request.Form("name")
rsObj("Pwd") = strPwd1
rsObj.Update
rsObj.Close
set rsObj = nothing
CloseConn()
%>
alert("添加成功!");
this.document.location = "userList.asp";
-->