fill a multi-table dataset for Oracle

F

feng

When I call a dataAdapter's Fill method to load a multi-
table dataset from SQL Server, I can use a sql string
something like "SELECT * FROM table1;SELECT * FROM table2"
as the command text and it will give me a dataset with two
tables. But my problem is that I have to support both SQL
Server and Oracle. Oracle doesn't seem to support this.
How do I do this in oracle?

The ideal solution for me would be one logic that supports
both data sources. Is it possible to 1) use separate
select statements to load a dataset that contain multiple
tables? How? or, 2) Does Oracle also support the same
combined sql select statements but with some different
syntax that's unknown to me?

Thanks
 
D

David Browne

feng said:
When I call a dataAdapter's Fill method to load a multi-
table dataset from SQL Server, I can use a sql string
something like "SELECT * FROM table1;SELECT * FROM table2"
as the command text and it will give me a dataset with two
tables. But my problem is that I have to support both SQL
Server and Oracle. Oracle doesn't seem to support this.
How do I do this in oracle?

The ideal solution for me would be one logic that supports
both data sources. Is it possible to 1) use separate
select statements to load a dataset that contain multiple
tables?

Yes. This is the perfered method for Oracle.

Using a Typed DataSet, create a DataSet with two DataTables and fill each
one with
SqlDataAdapter.Fill(DataTable)
or
OracleDataAdapter.Fill(DataTable)


eg:

MyDataSet ds = new MyDataSet();
.. . .
dataAdapter1.Fill(ds.MyTable1);
.. . .
dataAdapter2.Fill(ds.MyTable2);
.. . .


David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top