C # Connect the SQL Server database connection string < go to >

Source: Internet
Author: User

C # Connect a SQL Server database connection string, we introduce a parameter (note: The parameters are separated by semicolons):

"User Id=sa": The authenticated user name for the connection database is SA. He also has an alias "UID", so this sentence we can also write "Uid=sa".

"Password=": The authentication password for the connection database is empty. His nickname is "pwd", so we can write "pwd=".

Note here that your SQL Server must already have a username and password to log in, otherwise you cannot log in in such a way. If your SQL Server is set to Windows logon, then you do not need to use "User ID" and "password" to log in, but you need to use "TRUSTED_CONNECTION=SSPI" to log in.

"Initial Catalog=northwind": The data source used is the database "Northwind". His nickname is "Database", this sentence can be written as "Database=northwind".

"Server=yoursqlserver": Use a server named "YourSQLServer". His nickname is "Data Source", "Address", "Addr". If you are using a local database and you have defined the instance name, you can write as "server= (local) \ Instance name" or "(local)" to the name or IP address of the remote server if it is a remote server.

"Connect timeout=30": The connection time-out is 30 seconds.

C # Connect the SQL Server database connection string < go to >

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.