Last post Oct 25, 2011 12:40 PM by gsaadeh
Oct 25, 2011 11:34 AM|MoneyRan|LINK
i have been using Excel sheet as a Data Source to read and retrieve data as we would do from a SQL Database Table.
i wanted to know if there's any way I can set the control to read Row 7 as attribute names. Right now, the control automatically reads Row 1 as column headers. In my file, the first 6 rows have misc. information about the data and the actual "table" begins
from Row 7, that is Row 7 has column names and then after that the information.
If anyone needs more information, please let me know. I don't know what else to put here right now.
Oct 25, 2011 12:40 PM|gsaadeh|LINK
You could create a named region, by going into menu Insert--> Name -->Defiine, and create a named region with the required range.
If for instance your range name is myDataRange, then you could retrieve it using:
SpreadSheetName = "[sheet1$]"; //normal case
SpreadSheetName = "[myDataRange]"; //special case
ExcelCommand.CommandText = @"SELECT * FROM " + SpreadSheetName;