Ask a Question related to ASP Database, Design and Development.
-
Dyslexic #1
recordset while loop problem
Hi all,
I'm trying to write a bit of ASP code topopulate a select box, the data that
I'm using to fill the select box is in a recordset - which also contains
data for other selectboxes. - hence the 'manufacturer' feild getting
compared. The code I'm using is this -
<select name="select" size="1">
<option value="Select a Model!" selected="selected">Select a
Model</option>
<option value="Select a Model">Show All</option>
<%While ((NOT pullallmanhorizmodels.EOF) AND
(allsunbedman.Fields.Item("manufacturer").Value =
pullallmanhorizmodels.Fields.Item("manufacturer"). Value))%>
<option
value="<%=pullallmanhorizmodels.Fields.Item("model ")%>"><%=pullallmanhorizmo
dels.Fields.Item("model")%></option>
<% pullallmanhorizmodels.MoveNext
wend%>
</select>
It 'seem's' to be working until it gets to the last record, where it causes
the computer to hang?
Cheers.
Dyslexic Guest
-
PHP Recordset Paging problem
I am trying to set up record paging using the simple <<Previous Next>> setup. However, when I click the Next>> link, it doesn't show the rest of the... -
Recordset paging problem
I'm stuck on this one My recordset paging wont work. I've done a search page with a form and a table in it to post 2 values to the result page.... -
Recordset problem
Hi, here is my situation, in an access database i have a field which has 4 possible values (they are 'none', '1-2', '3-4', '5ormore') i want to... -
Recordset Problem with Access
I have created a log in page, which works and the information is routed to an Access database; I have also created a confirm page which is supposed... -
Problem with Recordset from SQL Server
I have just upsized an Access database to MS SQL and have begun converting and testing ASP pages created in Dreamweaver. After creating a Recordset... -
J. Baute #2
Re: recordset while loop problem
without really answering to your question,
why not change your SQL statement usign a JOIN to avoid having to use 2
recordset, while it's probably possible to get all the data in the format
you need in a single recordset, and thus simplifying things a lot
"Dyslexic" <I'hate-@ll&^SPAMH@r^esters.com> wrote in message
news:4wAfc.14228$Z07.7167@news-binary.blueyonder.co.uk...that> Hi all,
>
> I'm trying to write a bit of ASP code topopulate a select box, the datavalue="<%=pullallmanhorizmodels.Fields.Item("model ")%>"><%=pullallmanhorizmo> I'm using to fill the select box is in a recordset - which also contains
> data for other selectboxes. - hence the 'manufacturer' feild getting
> compared. The code I'm using is this -
>
> <select name="select" size="1">
> <option value="Select a Model!" selected="selected">Select a
> Model</option>
> <option value="Select a Model">Show All</option>
> <%While ((NOT pullallmanhorizmodels.EOF) AND
> (allsunbedman.Fields.Item("manufacturer").Value =
> pullallmanhorizmodels.Fields.Item("manufacturer"). Value))%>
> <option
>causes> dels.Fields.Item("model")%></option>
> <% pullallmanhorizmodels.MoveNext
> wend%>
> </select>
>
> It 'seem's' to be working until it gets to the last record, where it> the computer to hang?
>
> Cheers.
>
>
J. Baute Guest
-
Dyslexic #3
Re: recordset while loop problem
Hi Mate,
Thanks for your response, regarding your suggestion of using a JOIN
statement to get all this info in the one recordset - As you can see from my
code I currently have two recordsets, I did this because the first recordset
is looped round a Horiz/Vertical looper, the second recordset provides the
options for the selectbox (for each of the items in the first loop) - I did
try using a JOIN statement but had problems getting the JOIN statement to
work with my crappy access odbc/db (newbie alert here) - even if I get the
join statement to work I'll still be left with the problem of selecting the
correct/relevant items for each selectbox.(the data for many different
selectbox's is returned within the pullallmanhorizmodels recordset.
I'm sure I'm doing something silly here - could it possibly be to do with
comparing the two "manufacturer" fields once it reaches the last record
(n.b- even with a join statement I would need a condition like this to
separate the contents for each selkectbox). (As I said before - it works
fine until it reaches the last "pullallmanhorizmodels" record then just
seems to hang the web page (I can publish this page if it would provide any
useful info) there are no error messages or anything the server just stop's
serving the rest of the page.
Again - Cheers,
Dyslexic.
"J. Baute" <WUPYRDEDAWJD@spammotel.com> wrote in message
news:407f8374$0$992$a0ced6e1@news.skynet.be...contains> without really answering to your question,
> why not change your SQL statement usign a JOIN to avoid having to use 2
> recordset, while it's probably possible to get all the data in the format
> you need in a single recordset, and thus simplifying things a lot
>
> "Dyslexic" <I'hate-@ll&^SPAMH@r^esters.com> wrote in message
> news:4wAfc.14228$Z07.7167@news-binary.blueyonder.co.uk...> that> > Hi all,
> >
> > I'm trying to write a bit of ASP code topopulate a select box, the data> > I'm using to fill the select box is in a recordset - which alsovalue="<%=pullallmanhorizmodels.Fields.Item("model ")%>"><%=pullallmanhorizmo>> > data for other selectboxes. - hence the 'manufacturer' feild getting
> > compared. The code I'm using is this -
> >
> > <select name="select" size="1">
> > <option value="Select a Model!" selected="selected">Select a
> > Model</option>
> > <option value="Select a Model">Show All</option>
> > <%While ((NOT pullallmanhorizmodels.EOF) AND
> > (allsunbedman.Fields.Item("manufacturer").Value =
> > pullallmanhorizmodels.Fields.Item("manufacturer"). Value))%>
> > <option
> >> causes> > dels.Fields.Item("model")%></option>
> > <% pullallmanhorizmodels.MoveNext
> > wend%>
> > </select>
> >
> > It 'seem's' to be working until it gets to the last record, where it>> > the computer to hang?
> >
> > Cheers.
> >
> >
>
Dyslexic Guest
-
roger #4
Re: recordset while loop problem
"Dyslexic" <qwert@@@@.com>
Probably, but if that is the case I'm surprised that you don't get an error.> I'm sure I'm doing something silly here - could it possibly be to do with
> comparing the two "manufacturer" fields once it reaches the last record
Does this work ---
do until pullallmanhorizmodels.EOF
if pullallmanhorizmodels("manufacturer") = allsunbedman("manufacturer")
then
%><option value= ---etc--- </option><%
end if
pullallmanhorizmodels.MoveNext
loop
--
roger
roger Guest
-
Dyslexic #5
Re: recordset while loop problem
"roger" <mothland@btopenworld.com> wrote in message
news:c5pm5m$f2k$1@hercules.btinternet.com...with> "Dyslexic" <qwert@@@@.com>
>> > I'm sure I'm doing something silly here - could it possibly be to doerror.>> > comparing the two "manufacturer" fields once it reaches the last record
> Probably, but if that is the case I'm surprised that you don't get anallsunbedman("manufacturer")>
> Does this work ---
>
> do until pullallmanhorizmodels.EOF
>
> if pullallmanhorizmodels("manufacturer") =END SNIP> then
> %><option value= ---etc--- </option><%
> end if
>
> pullallmanhorizmodels.MoveNext
>
> loop
Hi Rodger,
Thanks for you help, I've tried many different ways to get the same logic as
what my original 'should' do but am failing horribly. I have tried and got
working your code (I used a 'while' outer loop, instead of your 'do until'
loop but it was essentially the same).
This code works perfectly within its own rights but does not give my desired
results because the 'do until' loop takes the 'pullallmanhorizmodels'
recordset right to it's end on its first go (remember this is all contained
within a horiz/vertical looper) so when it gets past filling the first
selectbox the conditions are never correct to allow it to fill the rest of
the select boxes. Is there a method of returning the recordset to its start
position? If I were to reset the record set to its start then it should work
correctly?
N.b I played with my original version and discovered that if I put a 'duff'
record at the end of the recordset so that 'I know' that the LAST items to
be tested will produce a false (and not run the code) it works as expected
WTF?
I'm losing it now and failing horribly to explain have a look at a test page
(n.b please no comments on anything other than this problem (this is still a
work in progress) (unless you know how to fix the menu to stop it going
under some of the other page items
[url]http://www.dyslexicfingars.net/ultratek/sunbedsall.asp[/url]
n.b. This page (currently) has the version with the 'IF' statement in it and
works - but only for the first selectbox.
Cheers
Dyslexic
Dyslexic Guest
-
roger #6
Re: recordset while loop problem
"Dyslexic" wrote
desired> This code works perfectly within its own rights but does not give mycontained> results because the 'do until' loop takes the 'pullallmanhorizmodels'
> recordset right to it's end on its first go (remember this is allstart> within a horiz/vertical looper) so when it gets past filling the first
> selectbox the conditions are never correct to allow it to fill the rest of
> the select boxes. Is there a method of returning the recordset to itswork> position? If I were to reset the record set to its start then it shouldActually, that was why I used 'do ... loop' -> correctly?
because you can use "exit do". I don't think
you can do that with "while".
do until pullallmanhorizmodels.EOF
if pullallmanhorizmodels("manufacturer")
= allsunbedman("manufacturer") then
%><option value= ---etc--- </option><%
else
exit do
end if
pullallmanhorizmodels.MoveNext
loop
'duff'> N.b I played with my original version and discovered that if I put aIf you have an expression like -> record at the end of the recordset so that 'I know' that the LAST items to
> be tested will produce a false (and not run the code) it works as expected
> WTF?
True and False and True and True
All languages have rules about whether to evaluate the whole expression
or just until the first 'False'.
I can't remember what VB does (or even what this is called),
but I guess it does the whole line.
So with -
NOT pullallmanhorizmodels.EOF AND pullallmanhorizmodels("manufacturer") =
allsunbedman("manufacturer")
The EOF has been reached but it still tries to evaluate
the next part of the expression.
If you run your original code again, and then do "view source"
on the web page, perhaps the error message is at the bottom
of the page.
page> I'm losing it now and failing horribly to explain have a look at a testa> (n.b please no comments on anything other than this problem (this is stillI don't think you can hide select boxes under other things.> work in progress) (unless you know how to fix the menu to stop it going
> under some of the other page items
AFAIK the only way is to use client side script to determine
when they are partially covered, and then hide the whole box.
It's messy, and it looks almost as bad.
You'll save yourself a lot brain ache if you just rearrange the page.
--
roger
roger Guest



Reply With Quote

