我无法删除datagridview中的文件

时间:2013-10-03 12:46:00

标签: vb.net datagridview error-handling delete-file

我正在使用此代码:

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中选择要删除的项目时,会显示错误消息:

  

“没有给出一个或多个必需参数的值。”

我不熟悉这个错误,因为我之前使用的删除按钮代码。

0 个答案:

没有答案