NPGSQL好像有一个比较大的bug?
这是一个奇怪的问题,当我运行以下代码时,所有行都从数据库返回。想象一下如果这是更新或删除会发生什么。
Dim cmd As New NpgsqlCommand
cmd.Connection = conn
cmd.CommandText = "select * FROM ac_profiles WHERE profileid = @profileId"
cmd.Parameters.Add("@profile", 58)
Dim dt As DataTable = DataAccess2.DataAccess.sqlQueryDb(cmd)
DataGridView1.DataSource = dt
我的问题是为什么会发生这种情况?
this is a weird one, when I run the following code all rows are returned from the db. Imagaine what would happen if this was an update or delete.
Dim cmd As New NpgsqlCommand
cmd.Connection = conn
cmd.CommandText = "select * FROM ac_profiles WHERE profileid = @profileId"
cmd.Parameters.Add("@profile", 58)
Dim dt As DataTable = DataAccess2.DataAccess.sqlQueryDb(cmd)
DataGridView1.DataSource = dt
My question is why is this happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是 pg-sql 专家,但我强烈怀疑这是因为您添加了与 SQL 语句中使用的参数不同的参数。我认为您还使用了错误的语法来引用参数。有关详细信息,请参阅用户手册。试试这个:
I'm no pg-sql expert, but I strongly suspect it's because you're adding a different parameter from the one you're using in the SQL statement. I think you're also using the wrong syntax to refer to a parameter. See the user manual for more information. Try this: