Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 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 May 23rd, 2006, 05:51 AM
Registered User
 
Join Date: Apr 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap 12 connection to a dbase

I am running Windows server 2003 as a server with IIS, the files are located in the server under InetPub wwwroot BegASPFiles, I have set up a virtual directory BegASP. I am working from a client machine Win XP Pro, and have had no trouble accessing the ASP pages I have created so far. Up until I tried to connect to an Access database.
I have placed the database in C:/datastores. I am using Movie2000.mdb. The dbase has a table named "Movies" and a column named "Title" with some data.

I run this code good right up until line 21. All will run fine, as soon as I introduce line 22, I get an internal Server error 500.
It doesnt seem to like objConn.Open

'Line 0
<%Option Explicit%>
<HTML>
<HEAD>
<TITLE>Testing our connection</TITLE>
</HEAD>
<BODY>
See this text?
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

Dim strDatabaseType
strDatabaseType = "Access"
Response.Write "objConn is Access"

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=C:\datastores\Movie2000.mdb;" & _
               "Persist Security Info=False"

objRS.Open "Movies", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

While Not objRS.EOF
  Response.Write objRS("Title") & "<BR>"
  objRS.MoveNext
Wend

objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>

</BODY>
</HTML>

I hope someone can shed some light. All the permissions seem to be ok..Im at a loss.



Thanks In Advance


Thanks In Advance
 
Old May 25th, 2006, 11:01 AM
Registered User
 
Join Date: May 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Where I think you are going wrong is that you are not using the full address to your file. c:\Inetpub\wwwroot\BegASPFiles\datastores\ Movie2000.mdb;
Depending on what or if any folder in the wwwroot you have the datastores folder in.
I hope this helps you out.







Similar Threads
Thread Thread Starter Forum Replies Last Post
chap 12 exer 2 harper BOOK: Beginning JavaScript 3rd Ed. ISBN: 978-0-470-05151-1 0 January 31st, 2008 10:19 AM
connection to dbase jardbf Classic ASP Basics 0 May 23rd, 2006 04:10 AM
chap. 12 -cmstables.php niy BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 January 12th, 2005 02:36 PM
ADO connection string to dBase IV EddyT Excel VBA 2 June 21st, 2004 02:59 AM





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