日期:2014-05-17  浏览次数:20856 次

inster into错误
<%  
dim   username  
dim   text  
username=request.Form( "name ")  
text1=request.Form( "text ")  
db= "db1.mdb "  
Set   conn   =   Server.CreateObject( "ADODB.Connection ")  
connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   &   Server.MapPath(db)  
'connstr= "driver={Microsoft   Access   Driver   (*.mdb)};dbq= "   &   Server.MapPath(db)  
conn.Open   connstr  
Set   con   =   Server.CreateObject( "ADODB.Recordset ")  
sql= "insert   into   user(name,text)   values   ( ' "   &   username   &   " ', ' "   &   text1   &   " ') "  
con.open   sql,conn,1,3  
sql1= "select   *   from   user   "  
con.open   sql1,conn,1,3  
response.write   con( "name ")  
set   con=nothing  
set   conn=nothing  
%>  
错误类型:  
Microsoft   JET   Database   Engine   (0x80040E14)  
INSERT   INTO   语句的语法错误。  
/liuyan.asp,   第   22   行  
数据库中就NAME和TEXT两个字段,望大家帮帮小第。

------解决方案--------------------
保留字问题sql= "insert into [user]([name],[text]) values ( ' " & username & " ', ' " & text1 & " ') "