Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-12-2005, 01:40 AM   #1 (permalink)
loumanley
Registered User
 
Join Date: Apr 2005
Posts: 1
loumanley is on a distinguished road
Displaying ASP help...

Hi,
I'm trying to set up a staff page, and Ive got it to work outputting all the photos with staff details such Name, Dept and Extension Num.
I wanted it to I could have three pictures per row horizontally across the page.
The only way I could get it to work like this was using the following code:

Code:
<html>
<head>

<%
dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("staff.mdb") & ";"
%>

</head>

<!--#include virtual="/header.inc" -->
<table width="90%" border="0" cellspacing="4" cellpadding="2" align="center">
  <tr valign="top"> 
    <td width="150" align="center" rowspan="5"><br>
    </td>
    <td colspan="3" bgcolor="#CCCCCC">      <p>Departmental Photo's</p></td>
  </tr>
  <tr> 
    <td height="134" colspan="3">      <p>Some Bumpf<p>

</p>

<%
dim mySQL
mySQL = "SELECT * FROM staff WHERE department LIKE '%Acc%' ORDER BY name ASC"
dim temp
Set temp = Server.CreateObject("ADODB.Recordset")
temp.Open mySQL, conn
%>

<table width="90%" align="left">
<% DO WHILE NOT temp.EOF 
%>
<tr>
<td align=center>
   <img src="/Pictures/<% Response.write temp("Picture")%>" width=200 height=150><br>
  <% Response.write temp("Name")%> <br> <% Response.write temp("Job_Title")%><br>
  <% Response.write temp("Department")%><br><% Response.write temp("Ext")%> 
</td>
<% temp.MoveNext %>
<td align=center>
   <img src="/Pictures/<% Response.write temp("Picture")%>" width=200 height=150><br>
  <% Response.write temp("Name")%> <br> <% Response.write temp("Job_Title")%><br>
  <% Response.write temp("Department")%><br><% Response.write temp("Ext")%> 
</td>
<% temp.MoveNext %>
<td align="center">
   <img src="/Pictures/<% Response.write temp("Picture")%>" width=200 height=150><br>
  <% Response.write temp("Name")%> <br> <% Response.write temp("Job_Title")%><br>
  <% Response.write temp("Department")%><br><% Response.write temp("Ext")%> 
</td>

<%
temp.MoveNext
Loop
%>
</table>
The problem I get though is if say I have 5 photos...it loops through the first three fine...but when it loops through the next three....because there are only five photos and not six...it coming up with a not at EOF error....because there's nothing to fill the last record:

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/accounts.asp, line 0

I know this is because its running through the output of the photographs and hitting the last record of photo output and there's nothing to output...but I can't see any other way of coding it so it outputs the page with three photos per row.

Any ideas?!!?
Thanks.
loumanley is offline   Reply With Quote
Old 04-12-2005, 02:06 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,694
redhead is on a distinguished road
take a look at this tut, and see if it gives away any hint as to some way you might be able to transform teh php code into your asp
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Links buchannon MS Technologies ( ASP, VB, C#, .NET ) 12 11-09-2004 12:24 PM
New Tutorials: ASP Strings, and Visual Studio/VB.NET sde Code Newbie News 0 03-25-2004 06:37 PM
New Java and ASP Tutorials sde Code Newbie News 2 03-15-2004 08:02 PM
Php Vs. Asp sde PHP 6 06-06-2003 06:02 PM


All times are GMT -8. The time now is 11:36 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting