I just wanna ask about something in my code
the scenario in this code is adding a data in the database with a lot of fields, its almost 55 fields to be inserted with data.
When I run this command and type improper words I notice that it will save the data but when i I proper and right words for each fields i get an error of
OledbException was Unhandled
Syntax Error(Missing Operator) in Query Expression
This is My Code
Dim importantmessage As String
importantmessage = MsgBox("Filling Up Complete, Are you sure you want to save this?", vbYesNo)
If importantmessage = vbYes Then
cmdInsert.CommandText = "INSERT INTO personinfo (SurName,FirstName,MiddleName,Present_CurrentAddress,ProvincialAddress,Noofchildren,Height,weight,birthdate,age,birtrhplace,gender,civilstatus,educationalattain,schoolname,course,yearsofstudy,collegestatus,trainingschoolname,positiontrained,yearstrained,coursetrained,detachment,Region,effdate,workstatus,empnumber,positionemployed,yearsofemployed,sssnumber,tinnumber,nbi,nbidate,pnp,pnpdate,priorexp,gdexp,guardposition,uniformdate,millitary,LOS,previousemp,licno,licdate,licexp,dateofemp,badgeno,neurocenter,neuroresult,neurodate,drugcenter,marijuana,shabu,drugresult,histories) VALUES ('" & txtsurname.Text & "','" & txtfirstname.Text & "','" & txtmiddlename.Text & "','" & txtaddress.Text & "','" & txtprovince.Text & "','" & txtchildren.Text & "','" & txtheight.Text & "','" & txtweight.Text & "','" & datepicker1.Text & "','" & txtage.Text & "','" & txtbplace.Text & "','" & cmbgender.Text & "','" & cmbcivil.Text & "','" & ComboBox4.Text & "','" & TextBox11.Text & "','" & TextBox10.Text & "','" & TextBox9.Text & "','" & TextBox8.Text & "','" & TextBox6.Text & "','" & ComboBox3.Text & "','" & TextBox7.Text & "','" & TextBox1.Text & "','" & ComboBox2.Text & "','" & ComboBox7.Text & "','" & MaskedTextBox3.Text & "','" & ComboBox1.Text & "','" & TextBox29.Text & "','" & TextBox30.Text & "','" & TextBox31.Text & "','" & TextBox5.Text & "','" & TextBox4.Text & "','" & TextBox3.Text & "','" & MaskedTextBox4.Text & "','" & TextBox2.Text & "','" & MaskedTextBox5.Text & "','" & TextBox24.Text & "','" & TextBox25.Text & "','" & ComboBox11.Text & "','" & MaskedTextBox6.Text & "','" & TextBox26.Text & "','" & TextBox28.Text & "','" & TextBox27.Text & "','" & TextBox32.Text & "','" & MaskedTextBox2.Text & "','" & MaskedTextBox1.Text & "','" & MaskedTextBox7.Text & "','" & TextBox12.Text & "','" & TextBox14.Text & "','" & ComboBox6.Text & "','" & MaskedTextBox8.Text & "','" & TextBox15.Text & "','" & ComboBox5.Text & "','" & ComboBox12.Text & "','" & MaskedTextBox9.Text & "','" & RichTextBox1.Text & "');"
cmdInsert.CommandType = CommandType.Text
cmdInsert.Connection = cnnOLEDB
cmdInsert.ExecuteNonQuery()
End If
If importantmessage = vbNo Then
Me.Show()
End If
I hope you will find the error Thank You.