下面的sql语句我在access中直接执行是没问题的,但是用asp的ADO组件访问数据库的方法来执行就不行,是在想不通是问什么?请大家指点下,小弟实一菜鸟
insert into CustomInfo (PassWord,Name,Telphone,Cellphone,Email,IDNumber,CreditNum) values( 'zhuyf666 ', 'zhuyf ', '8847278 ', '13572083217 ', 'zhuyf6666@126.com ', '610112198806308976 ', '11111 ')
下面是在asp中的代码
<%
dim coon
dim sql
dim conn
dim db
db= "DataBase\OrderOnline.mdb "
set conn=server.CreateObject( "ADODB.Connection ")
conn.connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= "
conn.connectionstring=conn.connectionstring & Server.mappath(db)
sql= "insert into CustomInfo (PassWord,Name,Telphone,Cellphone,Email,IDNumber,CreditNum) values( 'zhuyf666 ', 'zhuyf ', '8847278 ', '13572083217 ', 'zhuyf6666@126.com ', '610112198806308976 ', '11111 ') "
conn.open()
conn.execute(sql)
conn.close()
%>
下面是报错
错误类型:
Microsoft JET Database Engine (0x80040E14)
INSERT INTO 语句的语法错误。
/test.asp, 第 21 行
------解决方案--------------------
sql= "insert into CustomInfo ([PassWord],Name,Telphone,Cellphone,Email,IDNumber,CreditNum) values( 'zhuyf666 ', 'zhuyf ', '8847278 ', '13572083217 ', 'zhuyf6666@126.com ', '610112198806308976 ', '11111 ') "
password 在 Access是关键字
------解决方案--------------------
PassWord
我的blog写的很清楚,关键字不能使用
曾经困扰了我3天
------解决方案--------------------
<%
dim coon
dim sql
dim conn
dim db
db= "DataBase\OrderOnline.mdb "
set conn=server.CreateObject( "ADODB.Connection ")
conn.connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.mappath(db)
sql= "insert into CustomInfo ([PassWord],Name,Telphone,Cellphone,Email,IDNumber,CreditNum) values( 'zhuyf666 ', 'zhuyf ', '8847278 ', '13572083217 ', 'zhuyf6666@126.com ', '610112198806308976 ', '11111 ') "
conn.open()
conn.execute sql
conn.close()
%>