vb 删除数据库记录问题

来源:百度知道 编辑:UC知道 时间:2024/06/15 03:02:30
代码如下:

If Text1.Text = "" Or Text2.Text = "" Then
a = MsgBox("分店编码或分店名称不能为空!", , "错误提示")
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
Adodc1.RecordSource = "delete 分店编码,分店名称 from fd " & _
"where 分店编码 = text1.text and 分店名称= text2.text"
Adodc1.Recordset.Update
b = MsgBox("删除成功!", , "操作提示")
Adodc1.Refresh

End If

当执行到Adodc1.Refresh时,提示"至少一个参数没有被指定值"

Adodc1.RecordSource = "delete 分店编码,分店名称 from fd " & _
"where 分店编码 ='" + text1.text + "' and 分店名称='" + text2.text + "'"

SQL写的不正确。

Adodc1.Refresh 前面加
Adodc1.RecordSource = "select * from fd "

"delete from fd where 分店编码 = text1.text and 分店名称 = '" & text2.text & " '"