asp删除多条记录

来源:百度知道 编辑:UC知道 时间:2024/06/19 08:32:56
我想删除一个表中字段1值=参数a值,字段2值=b值,字段1,2,参数a,b均为数字类型的,语句该怎么写?a,b的值是从地址栏传递过来的参数。急急!帮帮忙吧
比如一个表comments,其中两个字段ct_class,ct_type,我想删除ct_class=a且ct_type=b的所有记录,语句该怎么写?

dim a,b
a=request.QueryString("地址栏传递过来的参数名")
b=request.QueryString("地址栏传递过来的参数名")
sql语句如下
delete from 表名 where 字段1=a and 字段2=b
如果把sql语句赋给变量,那么如下
dim sql
sql="delete from 表名 where 字段1="& a &" and 字段2="& b &""

conn.excute"delete ct_class,ct_type from comments where ct_class='"&request.QueryString("ct_class")&"' and ct_type='"&request.QueryString("ct_type")&"'"
conn是数据库连接名