Recently compiled SQL helper getting started instances are shared with you.

Source: Internet
Author: User
I will not introduce the famous sqlhelper here. There are many applications, but there are few examples of getting started. I recently sorted out how to package it for free and provided it for you to download, it contains all the source code of the SQL database and sqlhelper (with detailed instructions ). Code Come here: 1 Protected   Void Button#click ( Object Sender, eventargs E)
2 {
3 // Obtain the command to be executed
4 String Sqlexec = Textbox1.text;
5 Sqlcommand cmd =   New Sqlcommand ();
6 // Defines the storage range of object Resources. Once the using range ends, the resources occupied by the other party are released.
7 Using (Sqlconnection Conn =   New Sqlconnection (sqlhelper. connectionstringlocaltransaction ))
8 {
9 // Open connection (51aspx.com)
10 Conn. open ();
11 // Call the execution method. Because there is no parameter, the last item is directly set to null.
12 Sqlhelper. executenonquery (Conn, commandtype. storedprocedure, sqlexec, Null );
13 Response. Write ( " <Font color = Red> Operation complete! Check the database! </Font> " );
14 }
15 }

Sqlhelper is a very convenient database operation function. It has powerful functions and is very simple to use. It removes the need for a lot of complex database operation code. It has many applications in multi-tier applications and object-oriented development.


The sqlhelper source code is described in detail. The example contains the original example SQL statement of 51aspx.

The operations are as follows:

Simple SQL statement (excutesql)
Simple SQL statement with parameters (excutesqlparm)
Excuteproc)
Stored Procedure with parameters (excuteprocparm)
Returns only one field (excutescalar)
Response dataset (excutereader)

Source code:/files/liudao/51aspxsqlhelper_51aspx.rar

The database contains sample data and stored procedure updatetable \ updatetablebyparm. You can modify and test the data by yourself. Reprinted with the 51aspx author information. Thank you! For more information, see ~~
 Many experts may think it is simple, but I still believe that sqlhelper will not be used in many cases. I hope it will help you!

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.