Home All Groups Group Topic Archive Search About

Multiple result sets from Data Reader

Author
2 Feb 2006 7:09 PM
Keith G
Hi

I'm using VS 2003 to create a database application connecting to an Access
database through OleDb.
I've used the OleDbDataReader many times to populate comboboxes or treeviews
but only accessed one table at a time into the result set. No problem.

To be more efficient with the connection I would like to read several tables
at once by combining the sql select commands and using the datareader
NextResult to read each table in turn.
I can see examples of sqlDataReader doing this but not OleDbDataReader.
e.g.
"SELECT Name, Age FROM tbl_Employees; SELECT Sales, Qtr FROM tbl_Region"
I've tried this with and without the ';' separator but without success.

Thanks in advance for any comments.

Author
2 Feb 2006 7:31 PM
Kerry Moorman
Keith,

I don't believe Access supports multiple SQL statements like SQL Server does.

Kerry Moorman


Show quoteHide quote
"Keith G" wrote:

> Hi
>
> I'm using VS 2003 to create a database application connecting to an Access
> database through OleDb.
> I've used the OleDbDataReader many times to populate comboboxes or treeviews
> but only accessed one table at a time into the result set. No problem.
>
> To be more efficient with the connection I would like to read several tables
> at once by combining the sql select commands and using the datareader
> NextResult to read each table in turn.
> I can see examples of sqlDataReader doing this but not OleDbDataReader.
> e.g.
> "SELECT Name, Age FROM tbl_Employees; SELECT Sales, Qtr FROM tbl_Region"
> I've tried this with and without the ';' separator but without success.
>
> Thanks in advance for any comments.
>