Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP 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 March 8th, 2004, 12:04 PM
Authorized User
 
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default dsn-less connection problem

Hi, I was wondering if you could help me with this.

I am trying to set up a dsn-less connection from my asp page. I'm using the following code and I get this error. Am I making any strange mistakes? Is there something else I should be doing? I appreciate any ideas you may have.

Data source name not found and no default driver specified.

myDSN="Driver={SQL server};Server=prod;Database=web_code;Uid=web_code ;Pwd=webpwd"

Set conn = Server.CreateObject("ADODB.Connection")
conn.open myDSN,"",""
 
Old March 8th, 2004, 12:22 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Go to www.connectionstrings.com, look at the strings for SQL Server under OleDb Connection (.net), the one you are using is an odbc string, inefficient and less flexible.
Code:
sConnString = "Provider=sqloledb;Data Source=prod;Initial Catalog=web_code;User Id=web_code;Password=webpwd;" 
Set oConn = CreateObject("ADODB.Connection")        
oConn.ConnectionString = sConnString
oConn.open;
--

Joe
 
Old March 8th, 2004, 12:43 PM
Authorized User
 
Join Date: Jan 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your help! I added the providor argument and placed the code into my asp file instead of in the include. I'm not sure why the include makes a difference. Is there any reason why you wouldn't be able to put this information into an include file? Thanks again!

Justine
 
Old March 8th, 2004, 01:45 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

None at all, providing you are referencing the file correctly.

--

Joe





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
DSN Connection problem patwadd Classic ASP Basics 4 February 9th, 2005 04:26 AM
Security Error Using DSN Connection Adir Rovner ASP.NET 1.0 and 1.1 Basics 7 August 24th, 2004 09:30 AM





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