{
string strQuery = "SELECT *FROM [" + Table + "]";
System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(strQuery, conn);
System.Data.DataSet ds = new System.Data.DataSet();
adapter.Fill(ds);
return ds.Tables[0];
}
How to get each and every cell from the dataadapter?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

SenthilkumarRank #387 · 6.5K reputationPosted May 9, 2012, 2:58 AM EDT
Here the dataset was filled by the sql data adapter and no need to iterate the adapter.
You need to iterate the DataSet. Basically dataset can have many data tables.
for(int i=0;i
string firstcolumn = ds.Tables[0].Rows[i][0].ToString();
string secondcolumn = ds.Tables[0].Rows[i][1].ToString();
string thirdcolumn = ds.Tables[0].Rows[i][2].ToString();
string fourcolumn = ds.Tables[0].Rows[i][3].ToString();
}
Like that you can get the each cell....
Kunal VaishyaRank #990 · 2K reputationPosted May 9, 2012, 3:24 AM EDT
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
{
// I For ROw J For Column You can Get All Call
}
}