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.

enter image description here

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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -