Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic 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 September 21st, 2005, 08:09 PM
Authorized User
 
Join Date: Mar 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to arimakidd
Default DSN Less Problem

Can someone tell me why this simple script is not working? I am testing my asp locally and everything always works just fine. However I wanted to start using my work live on the net and to do this I have to use a DSN Less connection. This is the script:
Code:
<%
Dim obCOnn
Dim obJEc
Set obCOnn = Server.CreateObject("ADODB.connection")
Set obJEc = Server.CreateObject("ADODB.recordset")
obCOnn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("wrox.mdb")
obJEc.Open "SELECT * FROM sailor", obCOnn
obJEc.MoveFirst
Response.Write obJEc(name) & "<br>"
obCOnn.close
obJEc.close
Set obCOnn = Nothing
Set obJEc = Nothing
%>
The database is access and you guessed it, the name is wrox.mdb. Can someone tell me what's wrong?

 
Old September 22nd, 2005, 09:29 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

What sort of errors are you getting?

IMHO you would be better off using the jet driver instead off the access one...
Code:
provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=yourDataSource;
Is your db really in the same directory as your web page? If this is the case, a user could download your database direct from the web.

HTH,

Chris

 
Old September 23rd, 2005, 10:41 PM
Authorized User
 
Join Date: Mar 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to arimakidd
Default

Isn't it great when you can solve your own problems. I forgot the inverted commas around (name) when refering to the recordset:
Code:
Response.Write obJEc("name")
This is the code for the DSN Less Connection:
Code:
obCOnn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("data/wrox.mdb") & ";"





Similar Threads
Thread Thread Starter Forum Replies Last Post
odbc system dsn problem hope you can help jeremy1048 Access 5 May 9th, 2007 01:19 PM
odbc system dsn problem hope you can help jeremy1048 BOOK: Access 2003 VBA Programmer's Reference 0 May 7th, 2007 11:24 PM
DSN Connection problem patwadd Classic ASP Basics 4 February 9th, 2005 04:26 AM
Application DSN and Session DSN ssampanthar Classic ASP Databases 0 January 6th, 2005 01:23 PM
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.