Re: how-to fill a DataSet from an OleDbDataReader

  • Thread starter Thread starter Christian Pické
  • Start date Start date
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
 
Back
Top