求教(请问我向数据库中写入记录,这样写可以吗?为什么总是提示出错?
Dim MM_kkk_STRING
MM_kkk_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ= "& Server.MapPath( "/book.mdb ")
dim MM_editCmd
dim MM_editQuery
MM_editQuery= "insert book (name,email) values ( " "kkkk " ", " "dddd " ") "
dim jjj
jjj=MM_kkk_STRIN
Set MM_editCmd = Server.CreateObject( "ADODB.Command ")
MM_editCmd.ActiveConnection =jjj
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
%>
错误类型:
ADODB.Command (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/jjj.asp, 第 16 行
------解决方案--------------------MM_editQuery= "insert book (name,email) values ( " "kkkk " ", " "dddd " ") "
SQL语句有问题 insert into book (name,email) values ( " "kkkk " ", " "dddd " ")
------解决方案--------------------MM_editQuery= "insert book (name,email) values ( 'kkkk ', 'dddd ') "
就好
------解决方案--------------------MM_editQuery= "insert book (name,email) values ( 'kkkk ', 'dddd ') "
如果kkkk和dddd是变量的话
MM_editQuery= "insert book (name,email) values ( '&kkkk& ', ' "&dddd& " ') "
------解决方案--------------------笔误
如果kkkk和dddd是变量的话
MM_editQuery= "insert book (name,email) values ( ' "&kkkk& " ', ' "&dddd& " ') "