Re: how-to fill a DataSet from an OleDbDataReader

C

Christian Pické

Hi,

Take a look at this (sorry, it's in C#):

public DataSet GetMyDataSet()
{
OleDbConnection oConnection = new
OleDbConnection(GetConnectionString());
OleDbCommand oCommand = new OleDbCommand("SELECT * FROM myTable");
OleDbDataAdapter oAdapter = new OleDbDataAdapter();
oAdapter.SelectCommand = oCommand;
DataSet oDataSet = new DataSet();
oConnection.Open();
oAdapter.Fill(oDataSet);
return oDataSet;
}

You don't need to use a DataReader to fill a dataset. You use a datareader
to read records one by one.

Kind regards,

Christian
 

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