Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2007
    Posts
    1

    Unanswered: ASP SQL Connection String Problem

    Hi, posted this in the wrong place I think earlier, I hope this is more suitable...

    ==============================================

    Hi,

    I have some ASP code that connects to an Access database. I am now trying change this code so it connects to my new SQL server database.

    Can someone suggest what I am doing wrong as I get an error:

    Microsoft OLE DB Provider for SQL Server (0x80004005)
    [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

    Original connection string is:

    Set DBConn=Server.CreateObject("ADODB.Connection")
    DBConn.Provider="Microsoft.Jet.OLEDB.4.0"
    DBConn.Open Server.MapPath("../db/databasename.mdb")

    New string (not working) is:

    set DBConn = Server.CreateObject("ADODB.Connection")
    sConn = "Provider=SQLOLEDB.1;User ID=USERID;password=PASSWORD;Initial Catalog=DATABASENAME;Data Source = SQLSERVERNAME;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096"
    DBConn.Open sConn

    Many thanks.
    Robbo

  2. #2
    Join Date
    Nov 2004
    Posts
    285
    Provided Answers: 1
    Try the following code, pretty much the same:

    set DBCon = CreateObject("Adodb.Connection")
    DBCon.ConnectionString = "driver={SQL Server};SERVER=SERVER;uid=USERNAME;pwd=PASSWORD;da tabase=DATABASE"

    DBCon.Open

    Like I said pretty much the same as what you have, just don't need all the other parameters.

Posting Permissions

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