Hello,
I'm trying to delete a record from my access db using code and am getting an error message.
My code is as follows:
The error I'm getting is "Data type mismatch in criteria expression." and it's on the line "command.ExecuteNonQuery()"Code:Dim mDataPath As String = Application.StartupPath Dim strSelectedItem As String = DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(0).Value Try Using connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & mDataPath & "\DB.mdb") Using command As New OleDbCommand("DELETE * FROM tbl_Data WHERE ID = '" & strSelectedItem & "'", connection) connection.Open() command.ExecuteNonQuery() End Using End Using Catch ex As Exception MsgBox(ex.Message) End Try




Reply With Quote