I just wanna ask what's wrong with my code it says syntax error on INSERT STATEMENT but I can't find the error @.@
Try
Using conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Environment.CurrentDirectory & "\employeedb.mdb;")
conn.Open()
Dim command As New OleDbCommand("INSERT INTO employees (first_name, last_name, MI, address, age, contact, status, department, gender, position, date_hired) VALUES (@fname, @lname, @initial, @address, @age, @contact, @regularradio, @dept, @gender, @pos, @date1)", conn)
With command.Parameters
.AddWithValue("@fname", fname.Text)
.AddWithValue("@lname", lname.Text)
.AddWithValue("@initial", initial.Text)
.AddWithValue("@address", address.Text)
.AddWithValue("@age", age.Text)
.AddWithValue("@contact", contact.Text)
.AddWithValue("@regularradio", regularradio.Text)
.AddWithValue("@dept", dept.Text)
.AddWithValue("@gender", gender.Text)
.AddWithValue("@pos", pos.Text)
.AddWithValue("@date1", date1.Text)
End With
command.ExecuteNonQuery()
MessageBox.Show("Employee's Informations Recorded!", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information)
command.Dispose()
conn.Close()
fname.Text = ""
lname.Text = ""
initial.Text = ""
address.Text = ""
age.Text = ""
contact.Text = ""
regularradio.Checked = False
dept.Text = ""
gender.Text = ""
pos.Text = ""
date1.Value = Now.Date
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "ERROR12", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If