ASP. NET remote connection Database SQL Server

Source: Internet
Author: User
On the web. config node <connectionstrings>, add
<Configuration>
<Connectionstrings>
<Add name = "connectionserver" connectionstring = "Data Source = 192.168.133.30 (server address); initial catalog = shuidian (Database Name); persist Security info = true; user ID = SA (User Name); Password = (password); "/>
</Connectionstrings>
</Configuration>

Call method: configurationmanager. connectionstrings ["connectionserver"]. connectionstring;

For local access, you can set data source = .;

The Internet test cannot be performed because my network belongs to the LAN.

If the data server does not open port 1433 in the C/S structure, change the port, for SQL Server 2005, modify the SQL Server TCP port in SQL Server Configuration Manager to an available port, for example, 8000, and restart the SQL Server service. Client uses "Server = XXXXX. XXX. XXX. XX, 8000; database = xxx; uid = xx; Pwd = xx ",
It should be accessible.

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.