Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2005, 08:40 AM
Authorized User
 
Join Date: Jun 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default DSN Connection problem

I've managed to solve my earlier problem of connecting to a database using a connection string, but now I want to do it using a DSN (my web hosting service insists on DSNs).

This is the code:

Set objHCDynamicConn = Server.CreateObject("ADODB.Connection") 'line 15
objHCDynamicConn.Open "DSN=DB1","","password"

and this is the error:

Error Type:
Server object, ASP 0177 (0x800700C1)
800700c1
/uigpresql/development/dbtest.asp, line 15

I have checked the DSN setup and it is OK.

My setup is:
Win 2000 Pro
IIS 5
Frontpage 2002
Latest Jet Service Pack installed
MDAC 2.5 or 2.6 - not sure

I'm going nuts over this - it all worked absolutely fine under Win 98!

Pat

-------------------
System 3 2000 Limited
www.system3-2000.co.uk
__________________
-------------------
System 3 2000 Limited
www.system3-2000.co.uk (but very out-of-date!)
 
Old February 8th, 2005, 10:04 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

You have not mentioned which database you are using. I am assuming SQL server.

It has to be like this.

objHCDynamicConn.Open "DSN=DB1;UID=<username>;PWD=<password>;DATABASE=<d bname>"
 
Old February 8th, 2005, 12:22 PM
Authorized User
 
Join Date: Jun 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your reply.

It's actually Access at the moment but I shall keep the SQL details you posted because one of the main reasons for installing Win 2000 Pro is because I have to migrate the database to SQL Server.

Do you have the correct syntax for Access please?

Thank you
Pat

-------------------
System 3 2000 Limited
www.system3-2000.co.uk
 
Old February 9th, 2005, 12:44 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

For access, it is similar.

objHCDynamicConn.Open "DSN=DB1;UID=<username>;PWD=<password>"

If username and password are not set, you can simply use

objHCDynamicConn.Open "DSN=DB1"
 
Old February 9th, 2005, 04:26 AM
Authorized User
 
Join Date: Jun 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your help, I really am grateful.

I seem to have got everything working OK now.

Pat



-------------------
System 3 2000 Limited
www.system3-2000.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
ODBC DSN connection to Oracle Vera Classic ASP Databases 1 December 15th, 2006 10:13 AM
ODBC DSN connection atoyot BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 2 December 14th, 2006 06:40 PM
DSN Connection mred2nice Visual Studio 2005 0 October 31st, 2006 11:58 AM
Security Error Using DSN Connection Adir Rovner ASP.NET 1.0 and 1.1 Basics 7 August 24th, 2004 09:30 AM
dsn-less connection problem Justine SQL Server ASP 3 March 8th, 2004 01:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.