VB 2008 Express Compact SQL UPDATE query error

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2008
Posts: 42
Reputation: Bill Purkins is an unknown quantity at this point 
Solved Threads: 1
Bill Purkins Bill Purkins is offline Offline
Light Poster

VB 2008 Express Compact SQL UPDATE query error

 
0
  #1
Dec 21st, 2008
Hi,

Using VB 2008 Express with Compact SQL .sdf database.

I have a form that at form load fills the form with a single record as selected by double clicking row header on a datagrid. This works fine. But when I change a field and hit the save data button error I get an error that there must be a valid update statement.

So I figured, I'll just put a button on the form and on button click run a query statement like

UPDATE Names SET name = @p1, Address = @p2

This works, but it updates every record in the file, so I changed it to

UPDATE Names SET name = @p1, Address = @p2
WHERE Name = @p3, Address = @p4

But It won't compile. I get a build error.

How do I update a single record using the query builder in the table adapter. I have tried a number of things and am getting nowhere.

Thanks,
Bill Purkins
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 115
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: VB 2008 Express Compact SQL UPDATE query error

 
0
  #2
Dec 21st, 2008
You seem to have a syntax error in the SQL clause, it should be
  1. UPDATE Names SET name = @p1, Address = @p2
  2. WHERE Name = @p3 AND Address = @p4
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 42
Reputation: Bill Purkins is an unknown quantity at this point 
Solved Threads: 1
Bill Purkins Bill Purkins is offline Offline
Light Poster

Re: VB 2008 Express Compact SQL UPDATE query error

 
0
  #3
Dec 21st, 2008
THANK you! That was it ...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum


Views: 1969 | Replies: 2
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC