Step 10: perform operations on SQL Server in Asp.net

Source: Internet
Author: User

The most common steps to operate databases using SQL commands are as follows:Program.

1. Create a sqlconnection object (sqlconnection con = new sqlconnection ();)
2. connectionstring attribute assignment (connection string, Con. connectionstring = "";)
3. Con. open ()

4. Create a sqlcommand object (sqlcommand COM = new sqlcommand ();)
5. assign values to the commandtext attribute (SQL statement)
6. assign values to the commandtype attribute (commandtype. Text)
7. assign a value to the connection attribute (the sqlconnection object is assigned)
8. execute commands (executenonquery, executereader)

9. perform operations on the database return results

10. Close () of sqlconnection ()

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.