Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / October 2005

Tip: Looking for answers? Try searching our database.

How can I dig deeper to find the actual promblem?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PaulNaude - 28 Oct 2005 12:35 GMT
VB.NET 2003

I am battling with a specific procedure that does not allow me to update my
data adapter due to an apparent syntax error. I created the data adapter
usign the drag and drop method (from the Server Explorer to the form) by
dragging the table in question to the form and then generating the dataset.

In a procedure I add records to the problem table based on values in other
datagrids in the following way:

Dim drw As DataRow = DataSet51.Tables("InfluenceValues").NewRow()
drw(0) = DataGrid2.Item(DataGrid2.CurrentRowIndex, 0)
drw(1) = DataGrid3.Item(DataGrid3.CurrentRowIndex, 1)
                ...
drw(9) = 0 '{zero}
drw(10) = 0 '{zero}
DataSet51.Tables("InfluenceValues").Rows.Add(drw)

The added records display correctly in my datagrid and does not raise any
errors. The added records also match the existing records (execpt for one
column which has unique values).

When I (try to) update the data adapter

OleDbDataAdapter8.Update(DataSet51, "InfluenceValues")

I get the error:

System.Data.OleDb.OleDbException
Syntax error in INSERT INTO statement.

The automatically generated INSERT INTO statement reads as follows:

INSERT INTO InfluenceValues (Var1, Var2, Var3, Var4, Var5, Var6, Var7, Var8,
Var9, Var10, Var11) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Adding the exact same record manually into the actual database works
perfect, but even doing it manually into the datagrid gives the same error
when trying to update.

So, the error can't be in the syntax.

Using a error trap and messagbox, I derived the following additional info:

err.source = Microsoft JET Database Engine
err.targetsite = Int32 Update(System.Data.DataRow[],......

The above left me with the idea that it has to do with the 'double' value
columns (numbers) but since the data adapter creates the supporting code
itself, I can't immagine why it wouldn't accept any of the numbers I enter (I
even tried putting the zeros in quotes ("") and also tried setting the value
equal to a value allready in the database table)

How can I get more info to identify the actual problem?
Chris Dunaway - 28 Oct 2005 14:26 GMT
Regarding the INSERT statement you posted, are the actual variable name
Var1, Var2, etc?

I suspect that maybe you have a field in your database that is the same
as a reserved keyword.  Have you checked this possibility?
PaulNaude - 31 Oct 2005 07:40 GMT
Wow - I would never have thought!

No, the var1 etc were only examples.

I changed all the 'suspicious' field names by adding a number and it works
perfectly!! You saved me from a number of sleepless nights!

By the way, whithout me trying them all one by one and recreating the
adapters and dataset again, which one of the following field names could have
been the culpret:

Terrain
Day
Moon
Night

Thanks again!!!

> Regarding the INSERT statement you posted, are the actual variable name
> Var1, Var2, etc?
>
> I suspect that maybe you have a field in your database that is the same
> as a reserved keyword.  Have you checked this possibility?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.