c# - Extract data from cell -
the following code works fine , extracts data cells in sheet
using (oledbconnection con1 = new oledbconnection(connectionstring)) { var dt = new datatable(); string query = string.format("select * [{0}]", sheetname); con1.open(); oledbdataadapter adapter = new oledbdataadapter(query, con1); adapter.fill(dt); try { using (sqlconnection con = new sqlconnection(consstring)) { con.open(); (int = 1; < dt.rows.count; i++) { (int j = 1; j < dt.columns.count; j ++) { messagebox.show(dt.rows[i][j].tostring()); } } }
the code above extract data in green rectangle need extract data in red rectangle in following picture .
how extract data in rectangle not in green rectangle ?
you can change displayed digits changing region , setting in control panel, way full values displayed can fetched oledb connection. edit: after reading commment abount not changing excel cell column format suggest trying epplus.
Comments
Post a Comment