943,846 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1666
  • VB.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Sep 25th, 2009
0

error in insert into statement

Expand Post »
m using access 2007 and vb 2005
this is my code
VB.NET Syntax (Toggle Plain Text)
  1. Dim drNewRow As DataRow = m_DataTable.NewRow()
  2. drNewRow("Code") = txtColourCode.Text.Trim
  3. drNewRow("Colour Name") = txtBaseColour.Text.Trim
  4. drNewRow("Price") = txtPrice.Text.Trim
  5.  
  6. m_DataTable.Rows.Add(drNewRow)
  7.  
  8. m_DataAdapter.Update(m_DataTable)
Similar Threads
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Sep 25th, 2009
0

Re: error in insert into statement

That much looks correct, I'm assuming the error is in your actual insert statement connected to your adapter. Can you provide that query? Also add the exact error message that you are receiving.
Reputation Points: 84
Solved Threads: 48
Posting Whiz
TomW is offline Offline
342 posts
since Sep 2009
Sep 25th, 2009
0

Re: error in insert into statement

VB.NET Syntax (Toggle Plain Text)
  1. select * from accesstable
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Sep 25th, 2009
0

Re: error in insert into statement

Thats not an insert query...
Reputation Points: 84
Solved Threads: 48
Posting Whiz
TomW is offline Offline
342 posts
since Sep 2009
Sep 25th, 2009
0

Re: error in insert into statement

if i have to guess i would say the problem is in this line
drNewRow("Price") = txtPrice.Text.Trim
if the Price is declared as money then you have to convert the txtPrice.text
drNewRow("Price") = Convert.ToDouble(txtPrice.Text.Trim)
but as i said...without any more details its hard to guess.
Featured Poster
Reputation Points: 208
Solved Threads: 168
Practically a Master Poster
GeekByChoiCe is offline Offline
692 posts
since Jun 2009
Sep 26th, 2009
0

Re: error in insert into statement

price is declared as text in the database.
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Sep 26th, 2009
0

Re: error in insert into statement

then please provide su your Update query. the query you posted is a select query.
Featured Poster
Reputation Points: 208
Solved Threads: 168
Practically a Master Poster
GeekByChoiCe is offline Offline
692 posts
since Jun 2009
Sep 26th, 2009
0

Re: error in insert into statement

the data adapter handles my update insert and delete query...
Reputation Points: -1
Solved Threads: 23
Posting Whiz in Training
babbu is offline Offline
207 posts
since Jun 2009
Sep 26th, 2009
-1

Re: error in insert into statement

why not use ado.net instead?

use commandtext its easier!
Reputation Points: -3
Solved Threads: 0
Light Poster
raymyster is offline Offline
26 posts
since Jan 2008
Sep 26th, 2009
0

Re: error in insert into statement

Click to Expand / Collapse  Quote originally posted by babbu ...
the data adapter handles my update insert and delete query...
The dataadapter does not automatically create any of these commands.

If you are referring to the use of a commandbuilder attached to your dataadapter to generate the insert, update & delete statements; I would like to see the block of coding that creates this and fills your dataadapter so that I may see where it is causing you problems.

Also does the table have a primary key/unique field, the command builder needs this in order to be able to perform these statements.
Reputation Points: 84
Solved Threads: 48
Posting Whiz
TomW is offline Offline
342 posts
since Sep 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Small Probs
Next Thread in VB.NET Forum Timeline: Storing Data in Excel Worksheet Invisible to the User





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC