我正在使用这段代码:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim result = MessageBox.Show("Delete This Record?", "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = DialogResult.Yes Then
Dim sqldelete As String
sqldelete = "DELETE * FROM [product info] WHERE Barcode='" & DataGridView1.CurrentRow.Cells(6).Value.ToString & "'"
Dim adapter As New OleDbDataAdapter(sqldelete, strcon)
Dim dt As New DataTable("[product info]")
adapter.Fill(dt)
DataGridView1.DataSource = dt
RefreshDGV()
End If
当我在 datagridview 中选择要删除的项目时,它会显示一条错误消息:
“没有为一个或多个必需参数提供值。”
我不熟悉这个错误,因为我的删除按钮代码以前可以工作。