VB 删除checkbox选中的记录(任意的几条)的sql语句问题求助
For J = 1 To ListView1.ListItems.Count
If ListView1.ListItems(J).Checked Then
exec = "delete * from 文章列表 where id in(" + ListView1.ListItems(J).Text + ")"
End If
Next
rs.Open exec, conn, 3, 2
MsgBox "文章已经删除", 64, "温馨提示"
每次删除的时候却只能删除一条,求高手告诉我代码应该怎么写
[解决办法]
Dim DelList As StringFor J = 1 To ListView1.ListItems.CountIf ListView1.ListItems(J).Checked Then DelList=DelList & ListView1.ListItems(J).Text & "," '生成列表串End IfNextIf DelList<>"" Then DelList=left(DelList,len(DelList)-1) '去掉尾部的"," exec="delete * from 文章列表 where id in(" & DelList & ")" rs.Open exec, conn, 3, 2 MsgBox "文章已经删除", 64, "温馨提示"Else MsgBox "没有选择要删除的文章", 64, "温馨提示"End If