Can DataAdapter object accept DataTable as parameter in Fill method?

 Posted by Raja on 3/3/2009 | Category: ADO.NET Interview questions | Views: 8555


DataAdapter object can accept either DataTable or DataSet as parameter to fill data from database.


SqlDataAdapter dAd = new SqlDataAdapter();

DataTable dTable = new DataTable();
DataSet dSet = new DataSet();
dAd.Fill(dTable); // will also work
dAd.Fill(dSet); // will also work

We should only use DataSet as parameter when we are expecting more than one result set is being returned from database.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response