. NET work notes (1). net work notes
Physical path
context.Server.MapPath()
Obtains the value of a cell in the DataTable table.
tb.Rows[i][j]
Or
Tb. Rows ["a row"] ["a column"]
DataTable. Compute method
When creating an expression for a filter, if the column name contains any non-alphanumeric characters, starts with a number, or matches any of the following reserved words (case-insensitive), it requires special processing, as described in the following section.
And
Between
Sub-Level
False
Affiliation
Is
Like
Not
Null
Or
Parent level
True
If the column name meets one of the preceding conditions, it must be included in square brackets or in '(heavy note) quotation marks. For example, to use a Column named "Column #" in an expression, you should write it as "[Column #]":
Total * [Column#]
Or "'column number '":
Total * `Column#`
Read Excel
String strConn = "Provider = Microsoft. ACE. OLEDB.12.0; "+" Data Source = "+ path +"; Extended Properties = Excel 12.0; "; // AccessDatabaseEngine OleDbConnection conn = new OleDbConnection (strConn); conn. open (); DataTable dt = conn. getSchema ("Tables"); DataTableReader reader = new DataTableReader (dt); var ds = new DataSet (); while (reader. read () {string s = reader ["Table_Name"]. toString (); // obtain the sheet name var strExcel = string. format ("select * from [{0}]", s); var myCommand = new OleDbDataAdapter (strExcel, strConn); // obtain the data myCommand in sheet. fill (ds);} return ds;