VB的delete问题

来源:百度知道 编辑:UC知道 时间:2024/09/25 14:12:52
我需要在 学生表 中查询出某个班学生的学号,然后在 选课表 中删除这个班学生的记录要怎么写,下面是我的代码不知道哪错:

delete from t_xuanke
where sno in (select sno from t_students where bno=:a);

其中bno为班级编号,a为一变量, 当我直接用一字符串代替a的话能够成功,但我要用变量就不行了,哪位高手指导下.
大哥们啊,这是PB啊,哪有用影号把SQL语句标石起来,他还回执行?

"delete from t_xuanke where sno in (select sno from t_students where bno=" & a & ")"

应该是这样吧
"delete from t_xuanke where sno in (select sno from t_students where bno='" & a & "')"我这个和楼上的不一样啊
最后一个应该是'" & a & "' 能不能执行,调试一下就知道了