i can't save my data into access using vb.net
Dim SQL As String
DB.Open()
Dim Ad As New OleDbDataAdapter("Select * From candidate", DB)
Dim Check_dataset As DataSet
Check_dataset = New DataSet("check")
Ad.Fill(Check_dataset, "check")
If Check_dataset.Tables("Check").Rows.Count <> 0 Then
MsgBox("Certificate already exist.!!", MsgBoxStyle.Information, "")
DB.Close()
Exit Sub
End If
SQL = "INSERT INTO candidate(Cert_No, Cert_Exp_Date, Name, IC_Number, Company, State, Phone_no) values(" _
& "'" & certNoText.Text & "', " _
& "'" & DateTimePicker1.Text & "', " _
& "'" & textName.Text & "', " _
& "'" & icText.Text & "', " _
& "'" & comText.Text & "', " _
& "'" & AddText.Text & "', " _
& "'" & PhoneText.Text & "')"
Dc = New OleDbCommand(SQL, DB)
MessageBox.Show("All data have been save.", " ", MessageBoxButtons.OK, MessageBoxIcon.Information)
DB.Close()
*when i ru this program, MsgBox("Certificate already exist.!!", MsgBoxStyle.Information, "") will appear.. i don'r where is wrong