Results 1 to 3 of 3

Thread: ADO Connection String. Please Help!!!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Ireland
    Posts
    224
    Hi Guys.
    I'm trying to write a connection string and store it in a file called connection.asp.
    I have included the file using
    <!-- #INCLUDE FILE="Connection.asp" --> But I am having problems with string. Could someone please give me an example of using a connection string on a my Database.

    It is a SQL Server DATABASE on a machine called "SQLSAMPLE" which is a different machine to the one that I am storing my ASP's on. The Username is "User"and the password is "password". I want to use ADO to connect. Could someone please let me know how to do this.

    Thanks
    JK

  2. #2
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    Ok, i am not sure if this is what you want, but since no one else is helping, i will take a stab at it. I have a simular connection include file for connecting to an access database. I will post the contents below:

    Code:
    <%
    
    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("data.mdb")
    objConn.Open
    
    %>
    That is for an access database. But it may give you an idea of the format or something.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  3. #3
    New Member
    Join Date
    Mar 2001
    Location
    south africa
    Posts
    13
    Why don't you try

    <%

    Dim objConn
    Set objConn = Server.CreateObject ("ADODB.Connection")
    objConn.Provider = "SQLOLEDB"
    objConn.ConnectionString = "server=SQLSAMPLE;uid=user;pwd=Password;initial catalog = the name of your database"
    objConn.Open

    %>

    I hope it proves useful

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