. NET work notes (1). net work notes

Source: Internet
Author: User
Tags alphanumeric characters

. 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;

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.