How C # implements remote connection SQL Server2005

Source: Internet
Author: User
Server|sql

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] Server name, General Tim Machine Ipstrcons[1] Protocol DBMSSOCN (for TCP/IP protocol) strcons[2]] port number , typically 1433strcons[3] database name strcons[4] User name strcons[5] Password
       
        

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.



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.