|
-
Jul 18th, 2008, 12:41 PM
#1
Thread Starter
Lively Member
ASP gallery
I'm trying to make a photo gallery displaying pictures from links within a database.
I've done what I thought was correct but its throwing an HTTp 500 Internal Server Error.
Could someone please help me with the code
Code:
<HTML>
<HEAD>
<TITLE>Gallery Test</TITLE>
</HEAD>
<!--- ASP code inside the body tags --->
<BODY>
<!--- start of ASP code --->
<!--- long lines wrapped using a space and an underscore --->
<%
'Database variable store
Dim DB
'connecting to the database
Set DB = Server.CreateObject ("ADODB.Connection")
'open the database using the full path (DSN-less)
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + _
"http://www.projectpage.somee.com/gallery.mdb")
'create and set a variable for my data
Dim RS
Set RS = Server.CreateObject ("ADODB.Recordset")
'SQL to select ALL my photos
RS.Open "SELECT * FROM Photos", DB
'error check if there are any records
If RS.EOF And RS.BOF Then
Response.Write "There are 0 records."
'if theres no errors then
Else
'go to the first record
RS.MoveFirst
'HTML heading before the loop
%>
<h3 align="center"><b>Pictures</b></h3>
<br>
<%
'read through every record in turn until 'End Of File'
While Not RS.EOF
%>
<table border="0">
<tr>
<td><div align="center">
<a href="<%Respose.Write RS.Fields (("File Location"))%>" target="_blank">
<img src = "<%Response.Write RS.Fields (("Thumb Location"))%>" alt="<%Response.Write RS.Fields (("Alt Text"))%>">
</a>
</div></td>
</tr>
</table>
<%
'go to the next record
RS.MoveNext
'until the end
Wend
'stop when done
End If
'end of ASP
%>
<!--- back to HTML comment --->
</BODY>
</HTML>
Thanks
-
Jul 18th, 2008, 01:05 PM
#2
Re: ASP gallery
You're trying to open an MDB file via HTTP while that provider you're using expects a file path, not a URL. Try using the Remote Access Provider.
-
Jul 18th, 2008, 01:25 PM
#3
Thread Starter
Lively Member
Re: ASP gallery
erm im lost now, im still only learning the code.
I'm guessing I've set myself a higher limit than I can handle on my own.
Could you make it a little more simple for me to follow so I can see where I've gone wrong and what I have to do to rectify the mistake.
Thanks
-
Jul 18th, 2008, 01:34 PM
#4
-
Jul 19th, 2008, 05:17 AM
#5
Thread Starter
Lively Member
Re: ASP gallery
Cheers mendhak I releasised when I started reading the link you provided that I was supposed to use the server path.
I know have the connection working but I get an 800a01a8 error now, I've worked the error out to be being caused by my hyperlink code
Code:
<a href="<%Respose.Write RS.Fields (("File Location"))%>" target="_blank">
<img src = "<%Response.Write RS.Fields (("Thumb Location"))%>" alt="<%Response.Write RS.Fields (("Alt Text"))%>">
</a>
If i take the <a href> linking out the images display but with it in I get the error, anyone got any ideas on this?
Thanks for the help so far
-
Jul 19th, 2008, 11:13 AM
#6
Re: ASP gallery
What is the error message?
This is just minor changes but this might work
Code:
<a href='<%Respose.Write(RS.Fields("File Location"))%>' target='_blank'>
<img src = '<%Response.Write(RS.Fields("Thumb Location"))%>' alt='<%Response.Write(RS.Fields("Alt Text"))%>'>
</a>
-
Jul 19th, 2008, 01:38 PM
#7
Thread Starter
Lively Member
Re: ASP gallery
 Originally Posted by MarkT
What is the error message?
This is just minor changes but this might work
Code:
<a href='<%Respose.Write(RS.Fields("File Location"))%>' target='_blank'>
<img src = '<%Response.Write(RS.Fields("Thumb Location"))%>' alt='<%Response.Write(RS.Fields("Alt Text"))%>'>
</a>
it comes up saying
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/gallery.asp, line 62 which in my code is this line, same error when i use your code
Code:
<a href="<%Respose.Write RS.Fields (("File Location"))%>" target="_blank">
-
Jul 19th, 2008, 09:51 PM
#8
Re: ASP gallery
And you are getting that error with the changes to the code that I posted?
-
Jul 20th, 2008, 04:12 AM
#9
Thread Starter
Lively Member
Re: ASP gallery
 Originally Posted by MarkT
And you are getting that error with the changes to the code that I posted?
Yup same error code but less of the message displays, but it still refers me to the same line of code
I'm at a total loss with this
-
Jul 20th, 2008, 05:30 AM
#10
Re: ASP gallery
<a href="<%Respose.Write RS.Fields (("File Location"))%>" target="_blank">
Might be you have Response spelled incorrectly.
-
Jul 20th, 2008, 11:29 AM
#11
Thread Starter
Lively Member
Re: ASP gallery
 Originally Posted by MarkT
<a href="<%Respose.Write RS.Fields (("File Location"))%>" target="_blank">
Might be you have Response spelled incorrectly.
Doh, nice spot
I even retyped that, god i feel stupid lol
Any idea how to use this coding to display out as a datalist?
Thanks Again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|