1

Im new to vb.net and for some odd reason my delete is not working.It says Data type mismatch in criteria expression.

    Dim currentRows = DataGridView1.CurrentRow.Index
    If Not cnn.State = ConnectionState.Open Then
        cnn.Open()
    End If

    If txtCompany.Text <> "" Then
        Dim cmd As New OleDb.OleDbCommand
        If MsgBox("Do you want to delete this account?", vbYesNo) = MsgBoxResult.Yes Then
            cmd.Connection = cnn


            cmd.CommandText = "DELETE FROM [Work] WHERE eNum = '" & num & "'AND cResign = '" & dpResign.Value.Date & "' ;"
            cmd.CommandType = CommandType.Text
            cmd.Connection = cnn
            cmd.ExecuteNonQuery()
        End If
    End If
yuyu
  • 9
  • 1
  • Ok thank you yuyu, you have figured out how to solve it on your own :D – yuyu Jul 22 '15 at 06:46
  • Don't forget to post your solution as an answer for others to see. I think you're allowed to after 24 hours. – Josh Jul 22 '15 at 12:50

0 Answers0