Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to pass 2 queries in oledbcommand at a time????????????
Posted

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
 
Share this answer
 
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 ..."


You can read the results of the first query normally, then to read the results of the second query, call NextResult() on your reader.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900