943,824 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 3036
  • VB.NET RSS
Dec 21st, 2008
0

VB 2008 Express Compact SQL UPDATE query error

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
Bill Purkins is offline Offline
42 posts
since Jul 2008
Dec 21st, 2008
0

Re: VB 2008 Express Compact SQL UPDATE query error

You seem to have a syntax error in the SQL clause, it should be
SQL Syntax (Toggle Plain Text)
  1. UPDATE Names SET name = @p1, Address = @p2
  2. WHERE Name = @p3 AND Address = @p4
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Dec 21st, 2008
0

Re: VB 2008 Express Compact SQL UPDATE query error

THANK you! That was it ...
Reputation Points: 10
Solved Threads: 1
Light Poster
Bill Purkins is offline Offline
42 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

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: Music Sequencer written in Visual Basic
Next Thread in VB.NET Forum Timeline: displaying the values in the combobox





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


Follow us on Twitter


© 2011 DaniWeb® LLC