Dim RouteID As String
Dim Response As Integer
RouteID = InputBox("Enter the Route ID of the record to be deleted ")
If RouteID <> And Not Regex.IsMatch(RouteID, "[a-z]") Then
' Displays a message box with the yes and no options.
Response = MsgBox(Prompt:="NOTE: Are you sure ?" & vbCrLf & "Deleting this record will erase data from database", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\jai shri krishna\My Documents\Busmanagement.mdb")
str = "DELETE FROM RouteDetails WHERE RouteID = '" + RouteID + "'"
cmdDelete = New OleDbCommand(str, con)
cmdDelete.ExecuteNonQuery()' getting error datatype mismatch in criteria expression
str = "DELETE FROM RouteDetails WHERE RouteID = " & RouteID
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)