Solved

ASP and SQL connection 2005

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql query help 15 55
SQL server 2012 BPA and Baseline Configuration Analyzer 2.0 16 33
SQL Server Resume 5 46
Split string into 3 separate fields 5 22
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Viewers will learn how the fundamental information of how to create a table.

730 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