access 转换SQL后用户注册提示语法错误,请高后帮查查

dlfancy 2010-08-10 10:38:05
<%
dim RegUserName,Password,confirmPassword,question,answer,sname,ch,Province,city,area,address,post,zw,phone,mobile,fax,email
dim qymc,web,qylb,sortid,jyfw,qyxz,qyjj,errmsg,founderr
Form_Grp=Request("_fom_grp_")
Form_M=Request("M")
RegUserName=request.form(Form_Grp&Form_M&"usera")
Password=request.form("pass")
confirmPassword=request.form("confirmPassword")
question=request.form("question")
answer=request.form("answer")
sname=request.form("name")
siji=request.form("siji")
ch=request.form("ch")
Province=request.form(Form_Grp&Form_M&"Province")
city=request.form(Form_Grp&Form_M&"city")
area=request.form(Form_Grp&Form_M&"area")
address=request.form(Form_Grp&Form_M&"address")
post=request.form("post")
zw=request.form("zw")
phone1=request.form(Form_Grp&Form_M&"phone1")
phone2=request(Form_Grp&Form_M&"phone2")
phone3=request(Form_Grp&Form_M&"phone3")
mobile=request.form("mobile")
fax1=request.form(Form_Grp&Form_M&"fax1")
fax2=request.form(Form_Grp&Form_M&"fax2")
fax3=request(Form_Grp&Form_M&"fax3")
email=request.form("email")


web=request.form("web")
if web="http://" then web=""
if len(web)>7 and left(web,7) <> "http://" then web="http://" & web
qymc=request.form("qymc")
qylb=request.form("sortid")
'typeid=request.form("typeid")
jyfw=request.form("jyfw")
'Qyxz=request.form("Qyxz")
qyjj=request.form("qyjj")

dim Server_V1,Server_V2
Server_V1=Cstr(Request.ServerVariables("HTTP_REFERER"))
Server_V2=Cstr(Request.ServerVariables("SERVER_NAME"))

if session("yzm")<>request.form("txtVerify") then
Response.Write "<script>alert('对不起,输入的验证码和系统的验证码不一致!');history.back();</script>"
Response.End
end IF

If Mid(Server_V1,8,Len(Server_V2))<>Server_V2 Then
Response.Write "<script>alert('对不起,不能从外部提交数据');location.href='http://www.bearingpage.com';</script>"
Response.End
end if

if Password="" or strLength(Password)>12 or strLength(Password)<6 then
founderr=true
errmsg=errmsg & "<br><li>请输入密码(不能大于12小于6)</li>"
else
if Instr(Password,"<")>0 or Instr(Password,">")>0 or Instr(Password,"=")>0 or Instr(Password,"%")>0 or Instr(Password,chr(32))>0 or Instr(Password,"?")>0 or Instr(Password,"&")>0 or Instr(Password,";")>0 or Instr(Password,",")>0 or Instr(Password,"'")>0 or Instr(Password,",")>0 or Instr(Password,chr(34))>0 or Instr(Password,chr(9))>0 or Instr(Password,"")>0 or Instr(Password,"$")>0 then
errmsg=errmsg+"<br><li>密码中含有非法字符</li>"
founderr=true
end if
end if
if ConfirmPassword="" then
founderr=true
errmsg=errmsg & "<br><li>请输入确认密码(不能大于12小于6)</li>"
else
if Password<>confirmPassword then
founderr=true
errmsg=errmsg & "<br><li>密码和确认密码不一致</li>"
end if
end if


if qyjj="" then
founderr=true
errmsg=errmsg & "<br><li> 请填写企业简介!</li>"
end if

if founderr=false then
dim sqlReg,rsReg,sqladminname,rsadminname

'sqladminname="select * from Manage_user where UserName='" & RegUserName & "'"
'set rsadminname=conn.execute(sqladminname)

'if not(rsadminname.bof and rsadminname.eof) then
' founderr=true
' errmsg=errmsg & "<br><li>朋友,想冒充管理员?换一个用户名吧老大!</li>"
'else

set rs=server.CreateObject ("adodb.recordset")
' sql="select * from qyml where user='"®UserName&"'"
sql="select * from qyml"
rs.open sql,conn,3,3
' if not (rs.eof and rs.bof) then
' founderr=true
'errmsg=errmsg & "<br><li>你注册的用户已经存在!请换一个用户名再试试!</li>"
'else
rs.addnew
login_time=now()
'rs("user")=RegUserName
rs("pass")=Password
'rs("question")=question
'rs("answer")=answer
rs("name")=sname
rs("siji")=siji
rs("ch")=ch
rs("Province")=Province
rs("city")=city
rs("area")=area
rs("address")=address
rs("post")=post
rs("zw")=zw
rs("phone1")=phone1
rs("phone2")=phone2
rs("phone3")=phone3
rs("mobile")=mobile
rs("fax1")=fax1
rs("fax2")=fax2
rs("fax3")=fax3
rs("email")=email
rs("qymc")=qymc
rs("web")=web
'rs("qylb")=qylb
'rs("jygs")=jyfw
rs("qylb")=qylb
rs("idate")=login_time
rs("Flag")=0
rs("uflag")=0
rs("click")=0
'rs("Qyxz")=Qyxz
rs("qyjj")=dvHTMLEncode(qyjj)
rs.update

rs.close

set rs=nothing
set id=conn.execute("select top 1 id,pass from qyml where qyjj='"&qyjj&"' and qymc='"&qymc&"' and name='"&sname&"' and idate=#"&login_time&"# order by idate desc")
userid=id("id")
pass=id("pass")
id.close
set id=nothing
conn.execute("update qyml set [Usera]='"&userid&"' where id="&userid&"")
'set conn=nothing
response.write "<script>alert('注册成功!');top.location.href='regok.asp?userid="&userid&"&pass="&pass&"';</script>"
response.end
'end if
'end if
end if


if founderr=false then
call RegSuccess()
else
call WriteErrmsg()
end if

sub WriteErrMsg()
response.write "<br><br><table align='center' width='300' border='0' cellpadding='5' bacellspacing='0' style='BACKGROUND-COLOR:#E4EEFD;BORDER:#FFFFFF 1PX SOLID;PADDING:0PX 6PS;'>"
response.write "<tr class='title'><td align='center' height='22'>由于以下的原因不能注册用户!</td></tr>"
response.write "<tr class='tdbg'><td align='left' height='100'><br>" & errmsg & "<p align='center'>【<a href='javascript:onclick=history.go(-1)'>返 回</a>】<br></p></td></tr>"
response.write "</table>"
end sub

Sub SendRegEmail()
Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.ContentType = "text/html"
msg.MailServerUserName = "info@wliuw.com.com" '输入smtp服务器验证登陆名 (邮局中任何一个用户的Email地址)
msg.MailServerPassword = "dl4567" '输入smtp服务器验证密码 (用户Email帐号对应的密码)
msg.From = "info@wliuw.com.cn" '发件人Email
msg.FromName = "大连物流网" '发件人姓名
msg.AddRecipient email '收件人Email
msg.Subject = "大连物流网会员注册的通知" '信件主题
msg.Body = " 感谢你在大连物流网(<a href=""http://www.wliuw.com.cn"">http://www.wliuw.com.cn</a>)注册会员,你的用户名是:"®UserName&",您的密码:"&Password&"<br>"
msg.Body = msg.Body &"-----------------------------------------------------<br>"
msg.Body = msg.Body &"联系电话:0411-39569988<br>"
msg.Body = msg.Body &"传真:0411-84506540<br>"
msg.Body = msg.Body &"地址:"
msg.Send ("smtp.wliuw.com.cn") 'smtp服务器地址(企业邮局地址)
set msg = nothing
end sub

sub RegSuccess()
dim i,MaxNum
MaxNum=5
%>

提示139行语法错误,请高手帮解决
...全文
33 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
叫我梁大侠 2010-08-10
类型错误吧...
回复
SNOYC 2010-08-10
我也怀疑是类型的错误,最好的办法就是在红色字前加上
response.write("select top 1 id,pass from qyml where qyjj='"&qyjj&"' and qymc='"&qymc&"' and name='"&sname&"' and idate=#"&login_time&"# order by idate desc")
response.end()


还有idate=#"&login_time&"# 改成 idate='"&login_time&"'看看
这里应该没有必要用#吧,非要用,你改成idate=#'"&login_time&"'#看看
回复
把SQL打印出来,放在企业管理器里执行就知道什么错误了

应该是类型不对
回复
dlfancy 2010-08-10
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '22' 附近有语法错误。
/Reg/User_RegOK.asp, 第 193 行


浏览器类型:


第193行就是红色的部分
回复
应该是类型不对
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告