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.

Bill Purkins

8 Years
Discussion Span
Last Post by Bill Purkins

You seem to have a syntax error in the SQL clause, it should be

UPDATE Names SET name = @p1, Address = @p2
WHERE Name = @p3 AND Address = @p4
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.