Link to home
Start Free TrialLog in
Avatar of rruth
rruth

asked on

ASP and SQL connection 2005

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
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

For SQL Server authentication use this connection string:
Provider=SQLNCLI;Server=YourServerNameGoesHere;Database=YourDatabaseGoesHere;UID=YourUserNameGoesHere;PWD=YourPasswordGoesHere;"
Avatar of rruth
rruth

ASKER

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")

%>
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
a good help for everybody

http://www.connectionstrings.com/

Kept up-to-date
Avatar of rruth

ASKER

acperkins,

Thanks that worked great!