主题:请高手来帮我检查错误!找了好久没找出来!
请高手来帮我检查错误!找了好久没找出来!
我是用ASP.NET编的!在我的目录里表admin中有“编号(自动编号)user,姓名,password,问题,答案”这几个字段!
浏览器提示我insert语句语法错误!高手帮忙!谢谢!
下面是程序:
sub ins(sender as object,e as eventargs)
dim cnn as oledbconnection
dim cmd as oledbcommand
dim cnnstr as string
dim cmdstr as string
cnnstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("/data/mydata.mdb")
cnn=new oledbconnection(cnnstr)
cnn.open()
cmdstr="insert into admin (user,姓名,password,问题,答案) values (@user,@姓名,@password,@问题,@答案)"
cmd=new oledbcommand(cmdstr,cnn)
cmd.parameters.add(new oledbparameter("@user",oledbtype.char,20))
cmd.parameters.add(new oledbparameter("@姓名",oledbtype.char,30))
cmd.parameters.add(new oledbparameter("@password",oledbtype.char,30))
cmd.parameters.add(new oledbparameter("@问题",oledbtype.char,30))
cmd.parameters.add(new oledbparameter("@答案",oledbtype.char,30))
cmd.parameters("@user").value=t0.text
cmd.parameters("@姓名").value=t1.text
cmd.parameters("@password").value=clng(t2.text)
cmd.parameters("@问题").value=t5.text
cmd.parameters("@答案").value=t6.text
cmd.executenonquery()
if err.number<>0 then
msgbox(err.description)
else
dim re
re="successful.aspx"
response.redirect(re)
end if
cnn.close()
end sub
我是用ASP.NET编的!在我的目录里表admin中有“编号(自动编号)user,姓名,password,问题,答案”这几个字段!
浏览器提示我insert语句语法错误!高手帮忙!谢谢!
下面是程序:
sub ins(sender as object,e as eventargs)
dim cnn as oledbconnection
dim cmd as oledbcommand
dim cnnstr as string
dim cmdstr as string
cnnstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("/data/mydata.mdb")
cnn=new oledbconnection(cnnstr)
cnn.open()
cmdstr="insert into admin (user,姓名,password,问题,答案) values (@user,@姓名,@password,@问题,@答案)"
cmd=new oledbcommand(cmdstr,cnn)
cmd.parameters.add(new oledbparameter("@user",oledbtype.char,20))
cmd.parameters.add(new oledbparameter("@姓名",oledbtype.char,30))
cmd.parameters.add(new oledbparameter("@password",oledbtype.char,30))
cmd.parameters.add(new oledbparameter("@问题",oledbtype.char,30))
cmd.parameters.add(new oledbparameter("@答案",oledbtype.char,30))
cmd.parameters("@user").value=t0.text
cmd.parameters("@姓名").value=t1.text
cmd.parameters("@password").value=clng(t2.text)
cmd.parameters("@问题").value=t5.text
cmd.parameters("@答案").value=t6.text
cmd.executenonquery()
if err.number<>0 then
msgbox(err.description)
else
dim re
re="successful.aspx"
response.redirect(re)
end if
cnn.close()
end sub