Configuration of the SQL Server database connected to the LAN, sqlserver
First, make sure that the two machines are located in the same LAN, and then enable the configuration tool → SQL Server Configuration Manager to configure the TCP/IP IP (IP1, IP2) of the MSSQLSERVER protocol) change the TCP port to 1433, and enable the port to yes.
Server Name: Enter IP Address
Login Name: Enter the database account
Password: Enter the password of the database account
Description: It has no relationship with the Remote Desktop Connection, but it is related to the system firewall. You must use SQL Server or directly close the firewall.
How can asp remotely connect to the SQL server database outside the lan?
Select one of the three methods you are familiar:
(1) using odbc:
ADO (ActiveX Data Objects) provides a Connection object that can be used to establish and manage connections between applications and ODBC databases. Connection objects have various attributes and Methods. You can use them to open and close database connections. To write a database Connection script, first create an instance of the Connection object and then open the database Connection:
<%
Set conn = server. createobject ("adodb. connection ")
Conn. open "DSN = ODBC name; Database = Database name; UID =; PWD = ;"
%>
(2) establish a connection through oledb
Using the oledb method to establish a connection between the page and the database, you do not need to create an odbc dsn data source. Writing the following script to establish a connection with the data source is a simple and easy-to-use method.
<%
Set conn = server. createobject ("adodb. connection ")
Conn. open "Provider = SQLOLEDB; server = SQL server name or IP address; database = database name; uid =; pwd ="
%>
(3) establish a connection through the driver
You do not need to create an odbc dsn data source to establish a connection between the page and the database through the driver, but you must know the actual database file path or data source name (for example, SQLserver database ).
<%
Set conn = server. createobject ("adodb. connection ")
Conn. open "driver = {SQL server}; server = SQL server name or IP address; database = database name; uid =; pwd =" %>
C #: how to connect to SQL server in the LAN
Yes ..