473,769 Members | 2,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling include files in response.write, or do while loops

I want to include some asp if statements inside a do until loop,
predicated on the recordset going until EOF. I do not have any < % %>
delimiters inside the include file. The below doesnt show the character
I want to display:

<% do until rs.eof
response.write rs("position")
<!-- #include file="inc_.asp" -->
loop %>

...while hard coding the character with another response.write statement
will.

Thanks for any insights
..net sports

Jul 22 '05 #1
3 3109
Well, first off, I don't see an rs.movenext, nor do you break out of <% %>
to call the #include file (<!--#include does not belong inside <% %>
delimiters!). See what happens when you change it to:

<%
do WHILE NOT rs.eof
response.write rs("position")
%>
<!-- #include file="inc_.asp" -->
<%
rs.movenext
loop
%>

Next, why not #include a file once (or not at all), and have a function.
Then not only will you avoid having this #include file referenced 8000
times, you can also make the function respond directly to differences
between rows in your resultset. Much smoother architecture that way...

e.g.

inc_.asp

<%
function writeCharacter( )
response.write "bleh"
end function
%>

Now your loop becomes:

<%
do while not rs.eof
response.write "<br>" & rs("position")
writeCharacter( )
rs.movenext
loop
%>

I don't see the point of repeating an #include directive n times with the
same file, it doesn't seem to make sense to me at all.

--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.


".Net Sports" <ba********@cox .net> wrote in message
news:11******** *************@l 41g2000cwc.goog legroups.com...
I want to include some asp if statements inside a do until loop,
predicated on the recordset going until EOF. I do not have any < % %>
delimiters inside the include file. The below doesnt show the character
I want to display:

<% do until rs.eof
response.write rs("position")
<!-- #include file="inc_.asp" -->
loop %>

..while hard coding the character with another response.write statement
will.

Thanks for any insights
.net sports

Jul 22 '05 #2
> <%
do WHILE NOT rs.eof
response.write rs("position")
%>
<!-- #include file="inc_.asp" -->
<%
rs.movenext
loop
%>


The #include won't be performed N times. It will be performed once. It's a
textual include, not an ASP script command. Nevertheless the point about not
doing this (for other reasons) is well taken.
Jul 22 '05 #3
Right, important distinction. The file isn't #included n times, but the
code inside is still processed by the ASP engine n times (regardless of
whether it has ASP code or not). If it contains HTML, then that part it is
rendered by the browser n times.

Try this example:

<% for I = 1 to 5 %>
<!--#include file=bar.asp-->
<% next %>

Bar.asp:

<% response.write i & "<p>" %>

All in all, probably not *that* much different from calling a function, but
much more difficult to manage, IMHO.

On 3/16/05 11:11 PM, in article u2************* *@TK2MSFTNGP15. phx.gbl,
"Jonathan Dodds" <NO_REPLY> wrote:
<%
do WHILE NOT rs.eof
response.write rs("position")
%>
<!-- #include file="inc_.asp" -->
<%
rs.movenext
loop
%>


The #include won't be performed N times. It will be performed once. It's a
textual include, not an ASP script command. Nevertheless the point about not
doing this (for other reasons) is well taken.


Jul 22 '05 #4

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

Similar topics

3
3601
by: middletree | last post by:
I have a page which, according to the boss's instructions, needs to show one of two things, based on which radio button was chosen on the previous page. Because these 'things' are actually some chunks of code which contain sql queries, loops, etc., I think it might be best to put each of them into an include. Will this work: <%If strReports = "Detailed" then%> <!-- #INCLUDE FILE="builddetailedreport.asp" -->
3
2086
by: Max Hazelhurst | last post by:
Hi there, Got an include file causing a timeout on the server when it's called on... The code has a loop in it that I suspect may be the cause... I can forward the entire inc file should it be necessary... Many thanks as ever.. Max
5
1777
by: Chris Anderson | last post by:
Hi All. I have an ASP page that has over 150 records listed. I would like to have an "Index" (A,B,C,D...) at the very top of the page. Once a letter is clicked, I need to: 1) Call a SQL string like "SELECT * from WoD Where UCASE(WotD) LIKE " & UCASE(strSelected) & "*" & Chr(34) 2) Recall the SAME page (Not another ASP page) withpopulating with the new recordset.
8
8335
by: Vinod | last post by:
Hi, I have a problem, i am calling an exe from asp program. Its not working fine. When i execute the exe through the dos program directly i get the desired result. My exe will convert files in the folder to encrypted files. But when i call it thru asp program its not working fine. I have tried the following method.
9
3001
by: Sarath | last post by:
I am working with an application using ASP, getting below error when i am trying to include new asp include file. _____________________________________________________________________ Microsoft VBScript runtime error '800a0006' Overflow: '' ____________________________________________________________________ I am sure that there is no error in the new asp file as if i delete any existing include file then no issues.
30
2291
by: Tim Marshall | last post by:
Here's the scenario, A2003, Jet back end, illustrated with some cut down code at the end of the post: A proc dims a snapshot recordset (dim rst as Dao.recordset) and opens it. There are several nested do loops, going through the records in rst using .movenext. At one point in one of the loops, we'll say the rst is at record "a". Now, another subprocedure is called, passing rst to it. In the subprocedure, the recordset goes through a...
6
2126
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file = ...\includes\StaffingHeaders.inc -->" </Script> <%=ClientName%> ****************************************************************************
18
34816
jhardman
by: jhardman | last post by:
Have you ever wanted to upload files through a form and thought, "I'd really like to use ASP, it surely has that capability, but the tutorial I used to learn ASP didn't mention how to do this."? Have you looked around trying to find simple solutions but didn't want to wade through pages of complex code? Have you balked at paying for premade solutions that are probably overkill for your particular project? I'd like to walk you through the...
6
4192
by: j.woodcock | last post by:
is there a way of having a file that's name is a variable (eg dependant on the user name) act like a include. i know that you cant define the file for an include asp tag using a variable and that reading the file using "Response.Write FSO.OpenTextFile(ppp, 1, False, False).readall" prints the file, and treating it like a html file. can anyone suggest another way of doing this?
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
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,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
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
6674
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
5307
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...
1
3964
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
3564
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.