here is my screenshot of the error
Photo - Google+[
^]
What I have tried:
here is my code snippet of the current form
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text & TextBox2.Text & TextBox3.Text & TextBox4.Text & TextBox5.Text & TextBox6.Text & TextBox7.Text = Nothing Then
MsgBox("Please fill up all information.")
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
Else
Try
Dim myConnection As OleDbConnection
myConnection = New OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;Data Source=G:\Sem7 (Final Project)\Bookstore POS System\possys.mdb;Persist Security Info=false;")
Dim myCommand As OleDbCommand
myCommand = New OleDbCommand("INSERT INTO customer([ID],[c_name],[email],[phone],[nric],[sex],[race]) VALUES (@ID, @c_name, @email, @phone, @nric, @sex, @race)", myConnection)
Dim id As New OleDbParameter("@ID", OleDbType.VarChar)
Dim name As New OleDbParameter("@c_name", OleDbType.VarChar)
Dim email As New OleDbParameter("@email", OleDbType.VarChar)
Dim phone As New OleDbParameter("@phone", OleDbType.VarChar)
Dim nric As New OleDbParameter("@nric", OleDbType.VarChar)
Dim sex As New OleDbParameter("@sex", OleDbType.VarChar)
Dim race As New OleDbParameter("@race", OleDbType.VarChar)
id.Value = TextBox1.Text
name.Value = TextBox2.Text
email.Value = TextBox3.Text
phone.Value = TextBox4.Text
nric.Value = TextBox5.Text
sex.Value = TextBox6.Text
race.Value = TextBox7.Text
myCommand.Parameters.Add(id)
myCommand.Parameters.Add(name)
myCommand.Parameters.Add(email)
myCommand.Parameters.Add(phone)
myCommand.Parameters.Add(nric)
myCommand.Parameters.Add(sex)
myCommand.Parameters.Add(race)
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
myCommand.Dispose()
MsgBox("Account Created", MsgBoxStyle.Information, "Registered!")
myConnection.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End Sub