473,385 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DataSet Update Error

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
1 1000
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
2
by: Mojtaba Faridzad | last post by:
Hi, Please check these lines: DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet, "mytable"); DataRow row; row = dataSet.Tables.Rows; row.BeginEdit(); row = "555";
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
1
by: Henry | last post by:
Hi. I've been trying to modify my dataset and have been unsucessful. Any help would be great. What I have is a dataset in a session variable. Here is what I have done to stored into the dataset...
12
by: Graham Blandford | last post by:
Hi all, Would someone be able to tell me the most 'graceful' way of removing unwanted rows from a dataset based on a condition prior to update? OR, resetting the rows all to unchanged after they...
4
by: Peter Proost | last post by:
Hello group, what would be the best way to do the next thing: I've got a grid form with about 15000 records, when I double click a row a detail form is opened and the user can modify and save...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
7
by: Jean Christophe Avard | last post by:
Hi! I have a dataset that retreive all the item information from the database. I need to be able to edit them, in the dataset and in the database. I have this code, could anyone tell me if I'm...
3
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.