In addition to the above suggestion, you can look into using the Office Interop DLL's to read the excel file. This isn't a particularly "pretty" way of doing it, but depending on your requirements, you might need to do this.
I have successfully transferred the content of my excel files into dataset but the problem is:
Code:
foreach (DataRow row in objDataSet1.Tables[0].Rows)
{
string name = row.Table.Rows[0]["FirstName"].ToString();
string last = row.Table.Rows[0]["LastName"].ToString();
}
Although it loops I can only extract the data of the first row.
You are right, I don't need to go to another table in the row. I change the code to this:
Code:
foreach (DataRow row in objDataSet1.Tables[0].Rows)
{
string name = row.Field<string>("FirstName").ToString();
string last = row.Field<string>("LastName").ToString();
}