Connecting Tech Pros Worldwide Forums | Help | Site Map

Hotizontal Records Display in ASP.

iahamed via WebmasterKB.com
Guest
 
Posts: n/a
#1: Aug 10 '08
Hi all,

I need to display records Horizontally, I do not know for some reason this
code gives me an error, uses an access db.
Quote:
Quote:
> Error type:
Microsoft VBScript compilation (0x800A040E)
'loop' without 'do'
/aspcodes/DisplayROwsHorizon/index.asp, line 26
Loop

I normally use the While Not objRS.EOF and close it with a Wend. Using what
ever way here it clashes with the If Statement Logic.

Quote:
index.asp
</html>

<title>Hotizontal Records Display.</title>

<!--#include file="conn.asp"-->

<body>

<%
DIM mySQL, objRS
mySQL = "SELECT * FROM tblData"
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("Item")&"</td>"
ELSE
Response.Write "<td>"&objRS("Item")&"</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
%>

</body>

</html>

------------------------------------------------------------------------
Quote:
Con.asp
'Dim objRS Name is in Index so cannot redefine
'Dim objRS
set objRS= Server.CreateObject("ADODB.Connection")
objRS.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath
("/aspcodes/DisplayROwsHorizon/DisRowHorizon.mdb"))


Your Help in this regard will be Highly appreciated.

Thank you.

--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200808/1


Evertjan.
Guest
 
Posts: n/a
#2: Aug 10 '08

re: Hotizontal Records Display in ASP.


iahamed via WebmasterKB.com wrote on 10 aug 2008 in
microsoft.public.inetserver.asp.general:

Indeantation corrected:
Quote:
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("Item")&"</td>"
ELSE
Response.Write "<td>"&objRS("Item")&"</td>"
END IF
END IF
Quote:
recCount = recCount + 1
objRS.MoveNext
Loop
>
Response.Write"</tr></table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
If you do not do your indenting correctly,
you easily miss an END IF,
so that a LOOP cannot find it.s DO

Even so your logic seems flawed,
as I think you will like to see all fields,
just 3 in a <tablerow.

Try:

======================================
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
DO UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
Response.Write "<tr>"
END IF
Response.Write "<td>"&objRS("Item")&"</td>"
recCount = recCount + 1
IF recCount Mod 3 = 0 THEN
Response.Write "</tr>"
END IF
objRS.MoveNext
LOOP
IF recCount Mod 3 <0 THEN
Response.Write"</tr>"
END IF
Response.Write"</table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
======================================

Or if you think as I do,
that </tdand </trwill be,
like <tbody></tbody>,
inserted anyway by most browsers:

======================================
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
DO UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
Response.Write "<tr>"
END IF
Response.Write "<td>" & objRS("Item")
recCount = recCount + 1
objRS.MoveNext
LOOP
Response.Write"</table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
======================================

not tested.



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
iahamed via WebmasterKB.com
Guest
 
Posts: n/a
#3: Aug 10 '08

re: Hotizontal Records Display in ASP.


Hello Evertjan,

I was surprised to see a so speedy reply, Thank you so much. How ever still I
face the error having tried your codes too. Here the code I add with yours,
Please help me resolve this:


<%
DIM objRS, SQL
SQL = "SELECT * FROM tblData"
Set objRS = Server.CreateObject("ADODB.Connection")
objRS.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath ("/aspcodes/DisplayROwsHorizon/DisRowHorizon.mdb") & ";"
objRS.Open

'DIM mySQL, objRS
'mySQL = "SELECT * FROM tblData"
'Set objRS = Server.CreateObject("ADODB.Recordset")
'objRS.Open mySQL, objConn

IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
DO UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
Response.Write "<tr>"
END IF
Response.Write "<td>" & objRS("Item")
recCount = recCount + 1
objRS.MoveNext
LOOP
Response.Write"</table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF

%>

Thank you so much.

--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200808/1

Evertjan.
Guest
 
Posts: n/a
#4: Aug 10 '08

re: Hotizontal Records Display in ASP.


iahamed via WebmasterKB.com wrote on 10 aug 2008 in
microsoft.public.inetserver.asp.general:
Quote:
Hello Evertjan,
>
I was surprised to see a so speedy reply, Thank you so much. How ever
still I face the error having tried your codes too. Here the code I
add with yours, Please help me resolve this:
Please show the errortexrt and the exact line number.
Quote:
<%
DIM objRS, SQL
SQL = "SELECT * FROM tblData"
Set objRS = Server.CreateObject("ADODB.Connection")
objRS.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & Server.MapPath
("/aspcodes/DisplayROwsHorizon/DisRowHorizon.mdb") & ";" objRS.Open
>
'DIM mySQL, objRS
'mySQL = "SELECT * FROM tblData"
'Set objRS = Server.CreateObject("ADODB.Recordset")
'objRS.Open mySQL, objConn
>
IF Not objRS.EOF THEN
Response.Write "<table width='100%'>"
recCount = 0
DO UNTIL objRS.EOF
IF recCount Mod 3 = 0 THEN
Response.Write "<tr>"
END IF
Response.Write "<td>" & objRS("Item")
recCount = recCount + 1
objRS.MoveNext
LOOP
Response.Write"</table>"
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
>
%>
>
Thank you so much.
>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Adrienne Boswell
Guest
 
Posts: n/a
#5: Aug 11 '08

re: Hotizontal Records Display in ASP.


Gazing into my crystal ball I observed "iahamed via WebmasterKB.com"
<u42620@uwewriting in news:887e554c29268@uwe:
Quote:
I do not know How to thank you and the Great Forum of WebmasterKB.
This is One Forum that I always visit to get solutions in ASP. Its
nice to see the ASP Lovers here. Thank you So much, SO much for the
wonderful Help given in this Regard.
>
You are posting to Usenet, and WebmasterKB is giving you web based access
to it.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Evertjan.
Guest
 
Posts: n/a
#6: Aug 11 '08

re: Hotizontal Records Display in ASP.


Adrienne Boswell wrote on 11 aug 2008 in
microsoft.public.inetserver.asp.general:
Quote:
Gazing into my crystal ball I observed "iahamed via WebmasterKB.com"
<u42620@uwewriting in news:887e554c29268@uwe:
>
Quote:
>I do not know How to thank you and the Great Forum of WebmasterKB.
>This is One Forum that I always visit to get solutions in ASP. Its
>nice to see the ASP Lovers here. Thank you So much, SO much for the
>wonderful Help given in this Regard.
>>
>
You are posting to Usenet, and WebmasterKB is giving you web based
access to it.
You are so right, Adrienne.

Yet again another website trying to steal Our Phenominal Knowledge.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
iahamed via WebmasterKB.com
Guest
 
Posts: n/a
#7: Aug 12 '08

re: Hotizontal Records Display in ASP.


Hello,

Sorry If I caused any name misrepresentation. I just saw the Logo on top and
then had the courtesy in thanking. The voices are calling; due to its
manifestation of Virtue.

Best of luck to all.

Regards.

--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200808/1

Evertjan.
Guest
 
Posts: n/a
#8: Aug 12 '08

re: Hotizontal Records Display in ASP.


iahamed via WebmasterKB.com wrote on 12 aug 2008 in
microsoft.public.inetserver.asp.general:
Quote:
Sorry If I caused any name misrepresentation. I just saw the Logo on
top and then had the courtesy in thanking. The voices are calling; due
to its manifestation of Virtue.
[please always quote on usenet]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Closed Thread