SQL 中同一列名的多个值
这似乎是一个奇怪的问题,之前我通过会话变量发布了关于 ASP 多个值的另一个问题,现在我已经弄清楚了这一点,并设法将所有三个值传递给标签。然而现在我需要传递三个 ID 来为这三个值创建一个 gridview...所以对于我的 SQL 语句我有:
SelectCommand="SELECT [BookID], [book_title] FROM [tblBook] WHERE ([BookID ] = ?)">
所以我需要有 3 个 BookID=?,?,?例如,这可能吗?
或者有其他方法可以在ASP中实现吗?
this might seem like a weird question, earlier I posted another question on ASP multiple values through a session variable, I've now figured that out and have managed to pass all three values for instance to a label. Now however I need to pass the three IDs to create a gridview for the three values... So for my SQL statement I have:
SelectCommand="SELECT [BookID], [book_title] FROM [tblBook] WHERE ([BookID] = ?)">
So I need there to be 3 BookID=?,?,? for instance, is this possible?
Or is there another way to do it in ASP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为你正在寻找的是这样的:
i think what you're looking for is something like this:
在 SQL 中,您可以使用“IN”运算符来执行此操作。 SQL 查询将是
您必须将 book1,2,3 作为参数传递给 asp 函数。您可能必须通过附加参数来动态构造查询。像这样的东西
In SQL, you can use the 'IN' operator to do it. The SQL query would be
You will have to pass the book1,2,3 as parameters to the asp function. You might have to construct the query dynamically by appending the parameters. Something like this
我不确定你的问题,但我认为你正在寻找
IN
语句I'm not certain by your question, but I think you're after an
IN
statement