Print Page | Close Window

DISPLAY RECORDS HORIZONTALLY

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=16628
Printed Date: 29 March 2026 at 6:45pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: DISPLAY RECORDS HORIZONTALLY
Posted By: BlueMask
Subject: DISPLAY RECORDS HORIZONTALLY
Date Posted: 20 September 2005 at 11:00am
Pls help me, i want to show my images horizally. 3 by 3, but my code doesn't work.
 
Like as :
 
image1   image2   image3
 
image4   image5   image6
 
.......
 

<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("mydb.mdb") & ";"
objConn.Open
 
DIM mySQL, objRS
mySQL = "SELECT * FROM TblVeri"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, objConn
DIM recCount
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
Do UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
IF recCount <> 0 THEN
Response.Write "</tr>"
Response.Write "<tr><td>"&objRS("AD")&"</td>"
ELSE
Response.Write "<td>"&objRS("AD")&"</td>"
END IF
recCount = recCount + 1
objRS.MoveNext
Loop
Response.Write"</tr></table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
%>
 



Replies:
Posted By: padoxky
Date Posted: 23 September 2005 at 10:53am

I had used these method before. Try it should work. Is ODBC connection.

<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' HTTP="false"
' Catalog=""
' Schema=""

Set objConn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("mydb.mdb")


set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = objConn
objRS.Source = "SELECT * TblVeri"
objRS.CursorType = 0
objRS.CursorLocation = 2
objRS.LockType = 3
objRS.Open()
objRS_numRows = 0
%>

<%
Dim HLooper1__numRows
HLooper1__numRows = -2
Dim HLooper1__index
HLooper1__index = 0
objRS_numRows =objRS_numRows + HLooper1__numRows
%>

<head>

</head>

<div>
  <table border="0" cellspacing="2" cellpadding="2" width="100%">
   
    <tr>
      <td align="center" valign="middle"> <table width="98%" cellpadding="2" cellspacing="2">
          <%
startrw = 0
endrw = HLooper1__index
numberColumns = 3  'Set numbers columns you want
numrows = -1
while((numrows <> 0) AND (Not objRS.EOF))
 startrw = endrw + 1
 endrw = endrw + numberColumns
 %>
          <tr align="center" valign="top">
            <%
While ((startrw <= endrw) AND (Not objRS.EOF))
%>
            <td> <table width="100%" border="0" cellspacing="2" cellpadding="2">
                <tr align="left" valign="middle">
                & ;nbs p; <td width="22"></td>
                & ;nbs p; <td><font face="Verdana, Arial, Helvetica, sans-serif" size="3"><%=(objRS.Fields.Item("IMAGE_NAME").Value)%></a></font></td>
                </tr>
                <tr align="left" valign="middle">
                & ;nbs p; <td>&nbsp;</td>
                & ;nbs p; <td><i><%=(objRS.Fields.Item("IMAGE_DESCRIPTION").Value)%></i></td>
                </tr>
              </table></td>
            <%
 startrw = startrw + 1
 objRS.MoveNext()
 Wend
 %>
          </tr>
          <%
 numrows=numrows-1
 Wend
 %>
        </table></td>
    </tr>
    <tr>
      <td align="center" valign="middle" class="text"></td>
    </tr>
  </table>
</div>
<%
objRS.Close()
%>



-------------
NgWebDesigns



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net