-
Dear all,
How does one formulate the connection string to connect to an SQL Server database. Can I use the IP address of the machine rather than the name of the machine. Also I am using SQLOLEDB to connect to the database. Besdies is it posible to make the settings for a remote SQL Server machine i.e. can i create databases and make database settings in a remote SQL Server using ftp or something like that. Thanks in advance.
-
Here's what you need to do..
Code:
Option Explicit
Dim objConnection, objRecordset, strSQL
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=SQLOLEDB; Data Source=SERVER; Initial Catalog=DATABASE_ON_SERVER; User ID=USER; Password=PASSWORD"
objConnection.Open
Set objRecordset = Server.CreateObject("ADODB.Recordset")
strSQL = "SQL code goes here"
objRecordset.Open strSQL, objConnection
Rich
-
yes, IP addresses work; they go into the Data Source parameter.