Asp. NET connection SQL Server connection string

Source: Internet
Author: User
Tags sql server connection string

    • Reference namespaces
1      using    System.Data;    2      using   System.Data.SqlClient;  

    • Connection string
1 //A single instance exists in the Windows Authentication Mode database2     stringConnectionString ="Data source=localhost;initial catalog=northwind;integrated security=sspi;"3 //multiple instances exist in Windows Authentication Mode database4     stringConnectionString ="Data source=localhost\sqlexpress;initial catalog=northwind;integrated security=true;"5 //SQL Server authentication method ==data source=127.0.0.1 can link a local database6     stringConnectionString ="Data source=10.1.2.3;initial Catalog=northwind; User Id=sa; Password=abc123";

Among them "Integrated Security=sspi;" && "Integrated security=true;" Setting integrated security to SSPI or true is equivalent even if authenticated with the current Windows account credentials. However, in an ASP. NET program may be different from the current running hosting environment, the user point will vary

① use the ASP. NET account in Windows XP; ② use the Network Service account in Windows 2003 and later;③ is in visual Studio using the user account in the current development environment, not the ASP.

Asp. NET connection SQL Server connection string

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.