Possible Duplicate:
Is datareader quicker than dataset when populating a datatable?
public DataTable GetReviewsId(Objects myObjects)
{
DataTable tblBindReviews = new DataTable();
string Query = "";
try
{
Query = "select distinct ProductId from tblReview where ProductId in (select ProductId from tblProduct where R=0 and T=0)";
/*SqlConnection mySqlConnection = this.SetDatabaseConnection();
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(Query, mySqlConnection);
mySqlDataAdapter.Fill(tblBindReviews);*/
/*mySqlConnection.Open();
SqlCommand cmd = new SqlCommand(Query,mySqlConnection);
tblBindReviews.Load(cmd.ExecuteReader());*/
}
catch (SqlException ex)
{
throw new Exception(ex.Message);
}
finally
{
this.ClosedatabaseConnection();
}
return tblBindReviews;
}
In the above code i have written two ways(each inside the commented part) of retrieving data, one using data adapter and the other using datareader. which one of the two will run faster?