Results 1 to 3 of 3

Thread: SQL Server connection string

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    266
    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.

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Rochester NY, USA
    Posts
    93

    Cool

    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

  3. #3
    Guest
    yes, IP addresses work; they go into the Data Source parameter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width