有时候写ASP用conn.execute(sql)查询、更新、插入Aclearcase/" target="_blank" >ccess数据库数据时,明明正确的语句却往往会显示sql语句错误,相当恼火,特进行了归纳,可适当为字段添加“[”、“]”解决:
例1:select * from a
如出现错误,可改为:select * from [a]
例2:UPDATE [user] SET password = @#"&data1&"@# where secname=@#"&data2&"@#"
如出现错误,可改为:UPDATE [user] SET [password] = @#"&data1&"@# where secname=@#"&data2&"@#"
例3:INSERT INTO mybook ( name, by, mobile ) VALUES (@#"&data1&"@#,@#"&data2&"@#,@#"&data3&"@#)"
如出现错误,可改为:
INSERT INTO mybook ( [name], [by], [mobile] ) VALUES (@#"&data1&"@#,@#"&data2&"@#,@#"&data3&"@#)"