更新查询在表适配器中不起作用
我有一个表适配器,我想在其中查询数据库的更新。
UPDATE Polls
SET DateRequest = ?
WHERE (Id = ?)
但当我尝试执行它时它不起作用
_pollsAdapter.UpdatePollById(id, DateTime.Parse(RequestedDateBox.Text).ToOADate());
适配器还有一些其他查询用于选择或插入,它们都工作得很好。
我检查了 id
是否正确,或者语句中的任何其他错误是否可能导致它无法工作,但随后我会得到一个异常,不是吗?
另外,如果我检查返回值,我会得到 0
- 所以查询实际上没有编辑任何行,但我看不出任何原因。 id
是正确的,该语句是在表适配器中正确创建的,它不会抛出任何语法或任何错误......
我如何进一步调试这个问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的查询显示 DateRequest 和 ID,因此您需要以相同的顺序传递参数。你先传递身份证。
-- http:// Social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/8f09bdd7-ba53-4f0c-95c4-cdcb35dea4f2
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