i can't find the error converting data type varchar to numeric pls help..
i already wasted a lot of hours to identify this error.
conn = New SqlConnection("Server=GEN-PC;Data Source=GEN-PC\SQLEXPRESS;Initial Catalog=Brgy;Integrated Security=True;")
If ResidentialComboBox.Text = "" Or LNameTextBox.Text = "" Or FNameTextBox.Text = "" Or MNameTextBox.Text = "" Or GenderComboBox.Text = "" Or CivilStatusComboBox.Text = "" Or ReligionTextBox.Text = "" Or EducationTextBox.Text = "" Or ProfessionTextBox.Text = "" Or SalaryTextBox.Text = "" Then
MsgBox("Please fill out all the fields.", MsgBoxStyle.OkOnly)
Try
conn.Open()
Dim ra As New Integer
Dim rb As String
Dim rd As Date
rd = Date.Now
rb = BODDateTimePicker.Text
ra = DateDiff("yyyy", rd, rb)
autonum()
cmd = conn.CreateCommand
cmd.CommandText = "INSERT INTO Resident(ResidentNo, Residential, Street, Telephone, LName, FName, MName, Gender, Birthday, Age, CivilStatus, Religion, Education, Profession, Salary) VALUES('" & Trim(resident) & "','" & Trim(ResidentialComboBox.Text) & "','" & Trim(StreetTextBox.Text) & "','" & Trim(TelephoneTextBox.Text) & "','" & Trim(LNameTextBox.Text) & "','" & Trim(FNameTextBox.Text) & "','" & Trim(MNameTextBox.Text) & "','" & Trim(GenderComboBox.Text) & "','" & Trim(BODDateTimePicker.Text) & "','" & Trim(ra) & "','" & Trim(CivilStatusComboBox.Text) & "','" & Trim(ReligionTextBox.Text) & "','" & Trim(EducationTextBox.Text) & "','" & Trim(ProfessionTextBox.Text) & "','" & Trim(SalaryTextBox.Text) & "')"
cmd.ExecuteNonQuery()
If CheckBox2.Checked = True Then
'nothing
ElseIf CheckBox2.Checked = False Then
aspouse()
End If
If CheckBox3.Checked = True Then
'nothing
ElseIf CheckBox3.Checked = False Then
achild()
End If
If CheckBox4.Checked = True Then
'nothing
ElseIf CheckBox4.Checked = False Then
asibling()
End If
clear()
conn.Close()
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
End Try
End If