If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP SQL Connection String Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-07, 08:16
robbo_t robbo_t is offline
Registered User
 
Join Date: Feb 2007
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 02-28-07, 01:53
plsh plsh is offline
Registered User
 
Join Date: Nov 2004
Posts: 253
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On