{
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];
}
Loading
Kunal VaishyaPosted May 9, 2012, 7:24 AM
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
}
}
SenthilkumarPosted May 9, 2012, 6:58 AM
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....