473,804 Members | 2,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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/DisplayROwsHori zon/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>Hotizont al Records Display.</title>

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

<body>

<%
DIM mySQL, objRS
mySQL = "SELECT * FROM tblData"
Set objRS = Server.CreateOb ject("ADODB.Rec ordset")
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>"&objR S("Item")&"</td>"
ELSE
Response.Write "<td>"&objRS("I tem")&"</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.CreateOb ject("ADODB.Con nection")
objRS.Open ("Provider=Micr osoft.Jet.OLEDB .4.0; Data Source="& Server.MapPath
("/aspcodes/DisplayROwsHori zon/DisRowHorizon.m db"))
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 1945
iahamed via WebmasterKB.com wrote on 10 aug 2008 in
microsoft.publi c.inetserver.as p.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>"&objR S("Item")&"</td>"
ELSE
Response.Write "<td>"&objRS("I tem")&"</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("I tem")&"</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.CreateOb ject("ADODB.Con nection")
objRS.Connectio nString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
Server.MapPath ("/aspcodes/DisplayROwsHori zon/DisRowHorizon.m db") & ";"
objRS.Open

'DIM mySQL, objRS
'mySQL = "SELECT * FROM tblData"
'Set objRS = Server.CreateOb ject("ADODB.Rec ordset")
'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.publi c.inetserver.as p.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.CreateOb ject("ADODB.Con nection")
objRS.Connectio nString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=" & Server.MapPath
("/aspcodes/DisplayROwsHori zon/DisRowHorizon.m db") & ";" objRS.Open

'DIM mySQL, objRS
'mySQL = "SELECT * FROM tblData"
'Set objRS = Server.CreateOb ject("ADODB.Rec ordset")
'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@uwewrit ing in news:887e554c29 268@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.publi c.inetserver.as p.general:
Gazing into my crystal ball I observed "iahamed via WebmasterKB.com "
<u42620@uwewrit ing in news:887e554c29 268@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 misrepresentati on. 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.publi c.inetserver.as p.general:
Sorry If I caused any name misrepresentati on. 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
1729
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. e.g. SAVEBUTTON SS# EntryBox Name EntryBox Date EntryBox Revenue Generated EntryBox
0
1219
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 far. any thoughts? this only works with an adOpenKeyset cursor by the way. use any others any it spits out errors. thanks!!! <% 'If this is the first time the page is displayed then set the record
6
2509
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 products). Tables: tblCategoryDetails CategoryID SpecID
1
2399
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 about 80 records from the Orders table. 80 out of a 1000 records. Now our data entry form shows our customer addresses, but not customer order history. When looking at all of the tables, customer, payments, orders, they still have all of the...
9
4817
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 use OpenArgs because sometimes I don't want an empty form and sometime I don't. I tried everything, but until now without success. I hope that someone can help me out here. This is an example how I call the form:
1
2762
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 fill the datatable with a subset of the initial query result? In the windows Form, under the datagrid, I was thinking of adding a "Next" button that would display the next N records from the initial query, and a "Previous" that would display the...
4
2439
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 & ClassName (ClassID being the primary key) The TeacherClass table has 3 columns - TCID (AutoNumber), TeacherID & ClassID. One teacher can teach multiple classes & one class can be taught by multiple teachers. The TeacherClass table basically...
1
2863
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 for each record in a particular table (using the feature that allows you to drag and drop a field from a table in the database onto the form, automatically attaching a BindingNavigator and TableAdapter and all that jazz to it). As you probably know,...
2
3689
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 different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos of these records will be displayed in a combobox, say item1, item2, etc.. then,i have a datagrid...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.