G
GG
I have a very simple form that I am using to take in the information
and save it to the MS Access Database using dataset.
My DataAdapter is called dadConstituent
and dataset is called dstConstituent
I am getting a "Record Not Added - 0 - Microsoft Jet Database Engine -
Syntax Error in INSERT INTO statement -- 0"..
Please look at the Msgbox to see the format of the error that I am
printing out.
I am sure the problem is very small but I just can't seem to put my
finger on it.
THanks a ton,
GG
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnSave.Click
Dim rowNewRow As DataRow =
dstConstituent.ConstituentData.NewRow
Try
'rowNewRow("FileNumber") =
txtAutoNumber.Text
'rowNewRow("PersonIntake") =
cmbIntakePerson.Text
'rowNewRow("Category") =
cmbCategory.Text
'rowNewRow("LastName") =
txtLastName.Text
'rowNewRow("FirstName") =
txtFirstName.Text
'rowNewRow("MiddleInitial") =
txtMiddleName.Text
'rowNewRow("Title") = txtTitle.Text
'rowNewRow("Organization") =
txtOrganization.Text
'rowNewRow("PrimaryPhone") =
txtPriPhone.Text
'rowNewRow("PrimaryExt") =
txtPriExt.Text
'rowNewRow("PrimaryMobile") =
txtPriMobile.Text
'rowNewRow("PrimaryPager") =
txtPriPager.Text
'rowNewRow("PrimaryFax") =
txtPriFax.Text
'rowNewRow("PrimaryAddress") =
txtPriAddress.Text
'rowNewRow("PrimaryCity") =
txtPriCity.Text
'rowNewRow("PrimaryState") =
txtPriState.Text
'rowNewRow("PrimaryZip") =
txtPriZip.Text
'rowNewRow("OtherPhone") =
txtOtherPhone.Text
'rowNewRow("OtherExt") =
txtOtherExt.Text
'rowNewRow("OtherAddress") =
txtOtherAddress.Text
'rowNewRow("OtherCity") =
txtOtherCity.Text
'rowNewRow("OtherState") =
txtOtherState.Text
'rowNewRow("OtherZip") =
txtOtherZip.Text
'rowNewRow("Request") = txtRequest.Text
'rowNewRow("Action") = txtAction.Text
dstConstituent.Tables(0).Rows.Add(rowNewRow)
btnNext.Enabled = True
btnPrevious.Enabled = True
btnFirst.Enabled = True
btnLast.Enabled = True
btnAdd.Enabled = True
btnSave.Enabled = False
btnCancel.Enabled = False
dadConstituent.Update(dstConstituent)
dstConstituent.Clear()
dadConstituent.Fill(dstConstituent,
"ConstituentData")
' lblPosition.Text = "Record 1 of " &
(dstConstituent.Tables(0).Rows.Count)
Catch
MessageBox.Show("Record not added" &
" - " & Err.Erl & " - " & Err.Source
& " - " & Err.Description & " -- "
& Err.HelpContext)
End Try
End Sub
and save it to the MS Access Database using dataset.
My DataAdapter is called dadConstituent
and dataset is called dstConstituent
I am getting a "Record Not Added - 0 - Microsoft Jet Database Engine -
Syntax Error in INSERT INTO statement -- 0"..
Please look at the Msgbox to see the format of the error that I am
printing out.
I am sure the problem is very small but I just can't seem to put my
finger on it.
THanks a ton,
GG
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnSave.Click
Dim rowNewRow As DataRow =
dstConstituent.ConstituentData.NewRow
Try
'rowNewRow("FileNumber") =
txtAutoNumber.Text
'rowNewRow("PersonIntake") =
cmbIntakePerson.Text
'rowNewRow("Category") =
cmbCategory.Text
'rowNewRow("LastName") =
txtLastName.Text
'rowNewRow("FirstName") =
txtFirstName.Text
'rowNewRow("MiddleInitial") =
txtMiddleName.Text
'rowNewRow("Title") = txtTitle.Text
'rowNewRow("Organization") =
txtOrganization.Text
'rowNewRow("PrimaryPhone") =
txtPriPhone.Text
'rowNewRow("PrimaryExt") =
txtPriExt.Text
'rowNewRow("PrimaryMobile") =
txtPriMobile.Text
'rowNewRow("PrimaryPager") =
txtPriPager.Text
'rowNewRow("PrimaryFax") =
txtPriFax.Text
'rowNewRow("PrimaryAddress") =
txtPriAddress.Text
'rowNewRow("PrimaryCity") =
txtPriCity.Text
'rowNewRow("PrimaryState") =
txtPriState.Text
'rowNewRow("PrimaryZip") =
txtPriZip.Text
'rowNewRow("OtherPhone") =
txtOtherPhone.Text
'rowNewRow("OtherExt") =
txtOtherExt.Text
'rowNewRow("OtherAddress") =
txtOtherAddress.Text
'rowNewRow("OtherCity") =
txtOtherCity.Text
'rowNewRow("OtherState") =
txtOtherState.Text
'rowNewRow("OtherZip") =
txtOtherZip.Text
'rowNewRow("Request") = txtRequest.Text
'rowNewRow("Action") = txtAction.Text
dstConstituent.Tables(0).Rows.Add(rowNewRow)
btnNext.Enabled = True
btnPrevious.Enabled = True
btnFirst.Enabled = True
btnLast.Enabled = True
btnAdd.Enabled = True
btnSave.Enabled = False
btnCancel.Enabled = False
dadConstituent.Update(dstConstituent)
dstConstituent.Clear()
dadConstituent.Fill(dstConstituent,
"ConstituentData")
' lblPosition.Text = "Record 1 of " &
(dstConstituent.Tables(0).Rows.Count)
Catch
MessageBox.Show("Record not added" &
" - " & Err.Erl & " - " & Err.Source
& " - " & Err.Description & " -- "
& Err.HelpContext)
End Try
End Sub