Dim conn As New OleDb.OleDbConnection
conn.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Love.mdb"
Try
conn.Open()
Catch ex As Exception
MessageBox.Show(ex.Message, "connection to access failed")
End Try
Dim comm As New OleDb.OleDbCommand
comm.CommandText = "delete from customer where ID = " & TextBox1.Text
comm.Connection = conn
If comm.ExecuteNonQuery() = 1 Then
MessageBox.Show("Successful")
End If
comm.CommandText = "select ID from customer where contact = '" & TextBox3.Text & "'"
comm.Connection = conn
Dim dr As OleDb.OleDbDataReader = comm.ExecuteReader()
If dr.HasRows Then
Do While dr.Read()
MessageBox.Show("The Customer id is " & dr("ID"))
Loop
End If
conn.Close()