Results 1 to 11 of 11

Thread: ASP gallery

  1. #1

    Thread Starter
    Lively Member lil_bugga's Avatar
    Join Date
    Nov 2006
    Location
    Bishop's Stortford, Hertfordshire, UK
    Posts
    68

    Question 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

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  3. #3

    Thread Starter
    Lively Member lil_bugga's Avatar
    Join Date
    Nov 2006
    Location
    Bishop's Stortford, Hertfordshire, UK
    Posts
    68

    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

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: ASP gallery

    Try an ADO tutorial first?

    http://www.w3schools.com/ado/

  5. #5

    Thread Starter
    Lively Member lil_bugga's Avatar
    Join Date
    Nov 2006
    Location
    Bishop's Stortford, Hertfordshire, UK
    Posts
    68

    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

  6. #6
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    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>

  7. #7

    Thread Starter
    Lively Member lil_bugga's Avatar
    Join Date
    Nov 2006
    Location
    Bishop's Stortford, Hertfordshire, UK
    Posts
    68

    Re: ASP gallery

    Quote 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">

  8. #8
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: ASP gallery

    And you are getting that error with the changes to the code that I posted?

  9. #9

    Thread Starter
    Lively Member lil_bugga's Avatar
    Join Date
    Nov 2006
    Location
    Bishop's Stortford, Hertfordshire, UK
    Posts
    68

    Re: ASP gallery

    Quote 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

  10. #10
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: ASP gallery

    <a href="<%Respose.Write RS.Fields (("File Location"))%>" target="_blank">

    Might be you have Response spelled incorrectly.

  11. #11

    Thread Starter
    Lively Member lil_bugga's Avatar
    Join Date
    Nov 2006
    Location
    Bishop's Stortford, Hertfordshire, UK
    Posts
    68

    Re: ASP gallery

    Quote 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
  •  



Click Here to Expand Forum to Full Width