我向Access插入数据后显示INSERT INTO语法错误!!!
sub Button_Click( s as object,e as eventargs)
if name.text="" or job.text="" or pwd.text="" or email.text="" or phone.text="" or add.text="" then
msg.text="*请输入完整资料!"
else
dim sqlstr as string
dim myconn as OleDbConnection
myconn=new OleDbConnection(System.Configuration.ConfigurationSettings.AppSettings("connstr").ToString())
sqlstr="insert into User(Uname,Ujob,Upwd,Uemail,Uphone,Uadd) values('"& name.text &"','"& job.text &"','"& pwd.text &"','"& email.text &"','"& phone.text &"','"& add.text &"')"
myconn.open()
dim mycomm as new OleDbCommand(sqlstr,myconn)
mycomm.ExecuteNonQuery()
myconn.close()
msg.text="*资料已更新!"
name.text=""
job.text=""
pwd.text=""
email.text=""
phone.text=""
add.text=""
end if
end sub
当我点击确定后他就显示
INSERT INTO 语句的语法错误。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。
Source Error:
Line 19: myconn.open()
Line 20: dim mycomm as new OleDbCommand(sqlstr,myconn)
Line 21: mycomm.ExecuteNonQuery()
Line 22: myconn.close()
可是这段代码我是在其他可以正确运行的网站那里拿过来的,那些是我以前写的,是可以正常运行的啊,可是一放到这个网站里就不行了。数据库都是Access。