如何一次在oledbcommand中传递2个查询? [英] how to pass 2 queries in oledbcommand at a time?
本文介绍了如何一次在oledbcommand中传递2个查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何一次在oledbcommand中传递2个查询?????????????
how to pass 2 queries in oledbcommand at a time????????????
推荐答案
A SQL nested query is a SELECT query that is nested inside a SELECT, UPDATE, INSERT, or DELETE SQL query. Here is a simple example of SQL nested query:
product table contains columns Model, ManufacturerID ,Manufacturer
////
SELECT Model FROM Product
WHERE ManufacturerID IN (SELECT ManufacturerID FROM Manufacturer
WHERE Manufacturer = ''Dell'')
The nested query above will select all models from the Product table manufactured by Dell:
//output
Model
Inspiron B120
Inspiron B130
Inspiron E1705
我使用OleDb已经很长时间了,但是您可以尝试以下操作:
将两个SQL语句添加到以分号分隔的字符串中:
It''s been a long time since I used OleDb, but you could try this:
Add both SQL statements to a string separated by a semicolon:
"SELECT ... ; SELECT ..."
您可以正常读取第一个查询的结果,然后读取第二个查询的结果,请在阅读器上调用NextResult()
.
You can read the results of the first query normally, then to read the results of the second query, call NextResult()
on your reader.
这篇关于如何一次在oledbcommand中传递2个查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文