更新查询在表适配器中不起作用

发布于 2024-09-14 15:42:07 字数 497 浏览 2 评论 0原文

我有一个表适配器,我想在其中查询数据库的更新。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彩扇题诗 2024-09-21 15:42:07

您的查询显示 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文