Solved

ASP and SQL connection 2005

Posted on 2006-07-02
5
197 Views
Last Modified: 2012-08-14
Experts,

I need help setting up a SQL Server 2005 db connection using ASP. I have no problem connecting using Access but because SQL doesn't have a physical address to link to, I'm not sure how to set it up. I'm using XP and SQL Server is working fine when I connect using Coldfusion.

Thanks for your help
0
Comment
Question by:rruth
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17027435
For SQL Server authentication use this connection string:
Provider=SQLNCLI;Server=YourServerNameGoesHere;Database=YourDatabaseGoesHere;UID=YourUserNameGoesHere;PWD=YourPasswordGoesHere;"
0
 

Author Comment

by:rruth
ID: 17027467
I've tried to set this up like the examples I have for the Access db. Where am I going wrong? - Thank you for your help!

<%
serverName = "BABYRUTH4\SQLEXPRESS"
MyDatabase = "empsolutions"
MyUserId = "sa"
MyPassword = "password"

Set conn1 = Server.CreateObject("ADODB.Connection")

conn1.Open "Provider=" & SQLNCLI;Server=serverName;Database=MyDatabase;UID=MyUserId;PWD=MyPassword;

Set RS1      = Server.CreateObject("ADODB.Recordset")

%>
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 250 total points
ID: 17027492
Change this:

conn1.Open "Provider=" & SQLNCLI;Server=serverName;Database=MyDatabase;UID=MyUserId;PWD=MyPassword;

To:
conn1.Open "Provider=SQLNCLI;Server=" & serverName & ";Database=" & MyDatabase & ";UID=" & MyUserId & ";PWD=" & MyPassword & ";"
0
 
LVL 12

Expert Comment

by:Einstine98
ID: 17027513
a good help for everybody

http://www.connectionstrings.com/

Kept up-to-date
0
 

Author Comment

by:rruth
ID: 17027600
acperkins,

Thanks that worked great!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question