ASP制作插入数据时出现错误 高分、在线、急!

来源:百度知道 编辑:UC知道 时间:2024/05/09 14:08:04
制作一个自动插入数据到数据库的页面时,在写代码
intoqq.CommandText = "INSERT INTO () VALUES ()"时
在VALUES ()的括号中放入变量,显示错误,
请问如何在其中放入想要的变量如Request.QueryString("")等
试了!还是不可以

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/qq.asp, line 6

intoqq.CommandText = "INSERT INTO says(who) values('"+ Request.QueryString("qq") +"')

insert into table(field) values('"+ Request.QueryString("abc") +"');

字符数据的,要左右加单引号

sql语句错了
Insert into 表名 values()
放入变量时 +Request.QueryString("")+
例如:
string strSql = "Insert into tabTest values(" + Request.QueryString("ID") + Request.QueryString("NAME")+ ... + ")" ;

aa = request.queryString("aa")
intoqq.CommandText = "INSERT INTO 表名 (字段) VALUES ("'&aa&'")"

注释:在asp中写sql语句并上一个变量的时候是要用“&”这个符号的,而不能用“+”这个