I want to use adapter.Fill(ds); to get the data result,
and I hope this can contain two or more recordsets in the
dataset, then I can use ds.tables[i] to access the
different recordsets.

thanks

Re: how can I make the dataadapter to return multiple recordsets? by Deepak

Deepak
Wed Sep 17 05:39:06 CDT 2003

Recordsets do not exist in ADO.NET anymore. You do have DataTables which
provide a disconnected mechanism to access data. DataTable basically is the
in-memory representation of your the resultset derived from your query.
Your DataSet can contain two DataTables. And yes you can use ds.tables[i] to
access the DataTable.

--
Deepak

#*#*#*#*#*#*#*#*#*#
I code therefore I am

"younker" <younker@yeah.net> wrote in message
news:02aa01c37cf0$53aa70a0$a001280a@phx.gbl...
> I want to use adapter.Fill(ds); to get the data result,
> and I hope this can contain two or more recordsets in the
> dataset, then I can use ds.tables[i] to access the
> different recordsets.
>
> thanks



RE: how can I make the dataadapter to return multiple recordsets? by davidsc

davidsc
Wed Sep 17 18:50:21 CDT 2003


If you're working with a database and provider that support
returning multiple resultsets, then you can accomplish this with
a DataAdapter.

string strConn, strSQL;
strConn = "Provider=SQLOLEDB;Data Source=(local);" +
"Initial Catalog=Northwind;Trusted_Connection=Yes;";
strSQL = "SELECT CustomerID, CompanyName FROM Customers " +
"WHERE CustomerID LIKE 'A%';" +
"SELECT OrderID, CustomerID, OrderDate FROM Orders " +
"WHERE CustomerID LIKE 'A%'";
OleDbDataAdapter da = new OleDbDataAdapter(strSQL, strConn);
DataSet ds = new DataSet();
da.Fill(ds);


You can also use the DataAdapter's TableMappings collection
to control the name of the DataTables that the DataAdapter
creates/uses.

da.TableMappings.Add("Table", "Customers");
da.TableMappings.Add("Table1", "Orders");


I hope this information proves helpful.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2003 Microsoft Corporation. All rights reserved.