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

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

THANK you! That was it ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.