Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database script issue 1

Status
Not open for further replies.

SteveHigh

Technical User
Jan 17, 2007
158
GB
Hello

I am using the following script to show the records I have in a MS database:

<%
Dim DB, TBL
Set DB = Server.CreateObject("ADODB.Connection")
Set TBL = Server.CreateObject("ADODB.RecordSet")
DB.Mode = adModeReadWrite
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("Form.mdb"))

TBL.Open "Enquiries" ,DB

While NOT TBL.EOF
Response.Write("Name = " & TBL("Name") & "<br>")
Response.Write("Surname = " & TBL("Surname") & "<br>")
Response.Write("Country = " & TBL("Country") & "<br>")
Response.Write("Hobbies = " & TBL("Hobbies") & "<br>")
Response.Write("Date = " & TBL("Date") & "<br><br><br>")
TBL.MoveNext
Wend
TBL.Close

DB.Close

Set DB = Nothing
Set TBL = Nothing

%>

With the .asp file in the same directory as the database, this seems to work fine.

However, I need to move the database to a folder called private and use a physical connection.

I need to use something like this:

conn.Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\bus\web.com\private\Form.mdb;"

but don't seem to be having much joy in getting it to work.

I would be grateful for any advice.

Thanks.

Steve
 
By default your ASP executes in the security context of a local account named IUSR_<ServerName> and it is unlikely this account has permissions to access anything on the server outside the \Inetpub folder.

Options:
1. Grant more permissions to the IUSR_ account
2. Use a different account for anonymous access
3. Disable anonymous access and grant your users access to everything they need.


The third option is probably no good unless all your users are in one small office.
 
Hello Sheco

Thank you for your reply.

The problem does not seem that complicated. I am getting the following error message:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/showDetails.asp, line 14

The relevant code I have (changed from above to try to offer a physical path) is:

<%
Dim DB, TBL
Set DB = Server.CreateObject("ADODB.Connection")
Set TBL = Server.CreateObject("ADODB.RecordSet")
DB.Mode = adModeReadWrite

conn.Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\whatever\whatever\whatever\onForm.mdb;"

TBL.Open "Enquiries" ,DB

While NOT TBL.EOF
Response.Write("Name = " & TBL("Name") & "<br>")
Response.Write("Surname = " & TBL("Surname") & "<br>")
Response.Write("Country = " & TBL("Country") & "<br>")
Response.Write("Hobbies = " & TBL("Hobbies") & "<br>")
Response.Write("Date = " & TBL("Date") & "<br><br><br>")
TBL.MoveNext
Wend
TBL.Close

DB.Close

Set DB = Nothing
Set TBL = Nothing

%>

May I ask what is the missing 'object'?

Thanks.

Steve
 
>what is the missing 'object'?
>[red]conn[/red].Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\whatever\whatever\whatever\onForm.mdb;"
[tt][red]DB[/red].Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\whatever\whatever\whatever\onForm.mdb;"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top