views:

48

answers:

1

I have a table adapter on which I want to query an update to my database.

UPDATE Polls
SET DateRequest = ?
WHERE (Id = ?)

But it's not working when I try to execute it

_pollsAdapter.UpdatePollById(id, DateTime.Parse(RequestedDateBox.Text).ToOADate());

The adapter also has some other queries for selecting or inserting and they all work perfectly fine.

I checked if the id is correct or if any other error in the statement could cause it to not work, but then I would get an exception, wouldn't I?

Also, if I check for the return value, I get 0 - so the query actually edited no rows, but I can't see any reason why. The id is correct, the statement is correctly created within the table adapter, it throws no syntax or whatsoever-errors...

How could I debug this matter more?

+1  A: 

Your query shows DateRequest and the ID, so you need to pass the parameters in the same order. You are passing ID first.

-- http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/8f09bdd7-ba53-4f0c-95c4-cdcb35dea4f2

Remou
But why can I alter the order of parameters in the Designer then?
ApoY2k
No idea, sorry.
Remou
Well, still your note was correct and it solved the problem. Thanks =)
ApoY2k