By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

DataSet Update Error

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
GG:

You are trapping the whole block... a lot of things can go wrong with Update
so I'd recommend trapping an oledbException around it individually. Are
you sure it's the update that's triggering it? It could be a bunch of
things though, a bad connection string, a bad update statement etc.

Anyway, if you would , trap OleDbException and do a Debug.Assert(False,
ex.ToString) 'assuming ex is the variable name of the exception. That will
help narrow it down.
"GG" <ga****@gambhir-dot-net.no-spam.invalid> wrote in message
news:40**********@127.0.0.1...
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

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.