Click here to Skip to main content
15,614,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application I have used OLEDB database to store student information.
To retrieve information from the database, I have created a separate class which internally queries to database and then returns data in a dataset object.
Class Reader

//This method provides requested class student information.<br />
DataSet Dataset ReadStudentInformation(int class).<br />
{<br />
    //create dataset<br />
     DataSet ds = new DataSet();<br />
//Execute query<br />
OleDbDataAdapter DA = new OleDbDataAdapter(selectCommand,,connection);<br />
         //Fille data in dataset<br />
         DA. featureDataAdapter.Fill(ds, tableName);<br />
         return DA ;<br />
}<br />

Now at the client side I have added a loop to retrieve row information from the data set.
Please suggest the better approach.
Should we use DataReader in this case or above approach is correct.??
Updated 8-Jul-10 20:28pm

1 solution

Since you are using a Dataset but are only looping through data, a Datareader will definitely be better.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900