Problems encountered in. NET Programming for beginners (8)

Source: Internet
Author: User

One CSProgram. Only one data is connected. Therefore, the connection is the same. The sqlconnection variable must be constantly closed.

The thread pool does not close this object. It is also found from the data pool.

What is the difference between this connection and I don't close it? Which method is better?

 If you are always using this database connection and frequently need to use database resources, you do not need to close the database connection before using it, however, if you do not use database resources for a long time, you can close the connection and re-connect when you need to use it again.

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.