473,378 Members | 1,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Hotizontal Records Display in ASP.

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.
> 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.

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>

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

Aug 10 '08 #1
7 1922
iahamed via WebmasterKB.com wrote on 10 aug 2008 in
microsoft.public.inetserver.asp.general:

Indeantation corrected:
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
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)
Aug 10 '08 #2
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

Aug 10 '08 #3
iahamed via WebmasterKB.com wrote on 10 aug 2008 in
microsoft.public.inetserver.asp.general:
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.
<%
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)
Aug 10 '08 #4
Gazing into my crystal ball I observed "iahamed via WebmasterKB.com"
<u42620@uwewriting in news:887e554c29268@uwe:
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

Aug 11 '08 #5
Adrienne Boswell wrote on 11 aug 2008 in
microsoft.public.inetserver.asp.general:
Gazing into my crystal ball I observed "iahamed via WebmasterKB.com"
<u42620@uwewriting in news:887e554c29268@uwe:
>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)
Aug 11 '08 #6
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

Aug 12 '08 #7
iahamed via WebmasterKB.com wrote on 12 aug 2008 in
microsoft.public.inetserver.asp.general:
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)
Aug 12 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jack | last post by:
Hi, I need to build a asp page where it would serve as a data entry record page as well as display page for records saved. This page should also allow editing of records that has been saved. ...
0
by: kinane3 | last post by:
I'm guessing this has something to do with my cursor but I'm not sure. this is for a picture gallery app and when I upload pictures some pictures or records don't show up. this is what ia have so...
6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
9
by: Sandy | last post by:
Hi all, I have a form to list records (frmListIssue) which I call from different other forms. My wish is to display a message when the form is called and empty; no records to display. I want to...
1
by: VMI | last post by:
I need to display Access data in a datagrid but the Access table has over 2 million records. Since I can't fill a datatable with all those records but the user needs to see all of them, how can I...
4
by: rn5a | last post by:
A MS-Access DB has 3 tables - Teacher, Class & TeacherClass. The Teacher table has 2 columns - TeacherID & TeacherName (TeacherID being the primary key). The Class table too has 2 columns - ClassID...
1
by: dheroan | last post by:
Hi there, I'm fairly new to using databases with VB .NET. I'm currently working on an application using a Microsoft Access database as a data source. I have created a form to display the fields...
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.