How C # implements remote connection SQL Server 2005

Source: Internet
Author: User
Tags microsoft sql server management studio microsoft sql server management studio sql server management sql server management studio port number

This article describes in detail how C # implements remote connection SQL Server2005 steps.

First Configure SQLSERVER2005:

Open Microsoft SQL Server Management Studio directly to the Windows user connection, and then, in security, "new login" in the login name, you can add "OK" to the corresponding.

Then in your corresponding "database" in the "security" user, you build the user to add in.

Critical place, view server properties on security Select the SQL Server and Windows authentication mode point "OK" system prompts you to restart SQL Server you can "stop" and restart.

Then look at the code statement for C # connecting SQL Server2005:

strcon = strcon + @"Data Source=" + strcons[0];
strcon = strcon + "," + strcons[2] + ";";
strcon = strcon + "Network Library=" + strcons[1] + ";";
strcon = strcon + "Initial Catalog=" + strcons[3] + ";";
strcon = strcon + "User ID=" + strcons[4] + ";";
strcon = strcon + "Password=" + strcons[5] + ";";
strcon = strcon + "Persist Security Info=True";
strcons[0] 服务器名称,一般添机器的IP
strcons[1]协议DBMSSOCN(为tcp/ip协议)
strcons[2]]端口号,一般为1433
strcons[3] 数据库名
strcons[4] 用户名
strcons[5]密码

Port number should also be configured:

SQL Server 2005 Network configuration in SQL Server configuration management in the services and applications in Control Panel

The SERVER2005 protocol TCP/IP defaults to Disabled, and its properties set its port number to 1433 "OK" to start.



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.