Ado. NET 3rd Talk

Source: Internet
Author: User

The difference between a DataReader and a dataset

1, DataReader is only sequential forward reading data structure, occupy less memory, faster; the dataset is a data structure that dynamically (dynamic) processes records (which can be either forward-reversed payees data or record-readable) in a one-time read-in memory, occupying more memory Relative speed is relatively slow.

2, DataReader processing data need to connect the database all the time, but the dataset does not need to connect to the database after reading data.

3. DataReader can only process one result set, but multiple result sets (DataTable) may be stored in the dataset.

4. DataReader cannot be cached, but the dataset can cache the data.

Second, SqlHelper

In advance, the usual functions of the ADO are written in SqlHelper, the use of direct calls, shorten the development time, reduce the amount of code written.

Exectenonquery, ExecuteDataset, ExecuteScalar ... and other common functions in advance to do the encapsulation, when needed to call.

Third, IsPostBack

Distinguishes the postback request from the first postback and other operations when the Web page has a postback requirement.

Iv. Control Click events

OnClick: Server-Side Click event

OnClientClick: Client Click event

* * Perform a client click event before performing a server-side click event.

V. Methods for passing parameters between pages: Get pass Value

Add [?] after the page URL. And then the parameter name = the value of the argument is passed.

such as: <a href= "newspage.aspx?newsid=<% #Eval (" NewSID ")%>" > Details </a>

<% #Eval ("NewsId")%> ">: Binds the NewsId field value as it moves forward.

Vi. getting a variable value in the daemon

such as: <%=getnews ()%>//Get the value returned by Getnews () in HTML

* * String pieced together to get any kind of web page.

* * method to read a field value in tables in a dataset

Dt. Rows[0][title]. ToString ()//Gets the string value of the field called title in the first record in the DT table in the dataset

Ado. NET 3rd Talk

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.