Solved

ASP and SQL connection 2005

Posted on 2006-07-02
5
194 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now