asp.net - Read excel sheet cell in C# -
i try read .xls flie using c#.
this code
oledbcommand command = new oledbcommand("select [id], [name], [email] [sheet$]", connection); oledbdataadapter objadapter = new oledbdataadapter(); objadapter .selectcommand = command; dataset objdataset = new dataset(); objadapter .fill(objdataset1); dataview dv = objdataset .tables[0].defaultview; (int = 0; < dv.count; i++) { if (dv[i][0] != dbnull.value ) { } }
but in excel sheet cell has green color mark not read.
it null. how can read cells?
thank you.
based on past experience, excel making best guess each column's data type, , gets wrong. doesn't match presumed data type returned null. @ below, particularly regards imex setting.
http://www.connectionstrings.com/excel#microsoft-jet-ole-db-4-0
Comments
Post a Comment