asp ADODB.Recordset 错误 '800a0bb9' 参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
代码如下:setrs=server.CreateObject("ADODB.recordset")ifrequest.QueryString("act")="del"th...
代码如下:
set rs = server.CreateObject("ADODB.recordset")
if request.QueryString("act")="del" then'如果是删除记录 idc = request.QueryString("id") conn.begintrans 'conn.execute"delete from user where u_id"&id 'conn.execute"delete from info where i_uid"&id rs.open "select* from user where u_id = "&idc,1,3 rs.delete rs.close rs.open "select* from info where i_uid="&idc,1,3 rs.delete rs.close end if%>
user表中有u_id,u_code,u_user
info表中有i_uid等字段
求大神指点是哪出错了 展开
set rs = server.CreateObject("ADODB.recordset")
if request.QueryString("act")="del" then'如果是删除记录 idc = request.QueryString("id") conn.begintrans 'conn.execute"delete from user where u_id"&id 'conn.execute"delete from info where i_uid"&id rs.open "select* from user where u_id = "&idc,1,3 rs.delete rs.close rs.open "select* from info where i_uid="&idc,1,3 rs.delete rs.close end if%>
user表中有u_id,u_code,u_user
info表中有i_uid等字段
求大神指点是哪出错了 展开
1个回答
展开全部
rs.open "select* from user where u_id = "&idc,1,3
rs.delete
rs.close
rs.open "select* from info where i_uid="&idc,1,3
rs.delete
rs.close
改为
conn.execute "delete from [ user] where u_id in ("&idc&")"
conn.execute "delete from info where i_uid in ("&idc&")"
或
conn.execute "delete from [ user] where u_id ="&idc
conn.execute "delete from info where i_uid = "&idc
rs.delete
rs.close
rs.open "select* from info where i_uid="&idc,1,3
rs.delete
rs.close
改为
conn.execute "delete from [ user] where u_id in ("&idc&")"
conn.execute "delete from info where i_uid in ("&idc&")"
或
conn.execute "delete from [ user] where u_id ="&idc
conn.execute "delete from info where i_uid = "&idc
追问
下面两种答案是怎么回事?第一种方法中的idc只是一个变量,不是数组啊,还有为什么要加中括号?为什么只有user加而info不加?使用open方法和使用conn.execute有什么不同。初学者,谢谢!
追答
u_id in 是批量删除
i_uid = 是单个删除
user加括号:因为user是系统内置的保留名称,info不是,加括号是为了更精准有效地识别
使用open方法和使用conn.execute结果没什么不同:一个繁杂一个简洁
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询