Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

looping - is making me loopy

You're on the Christmas list regardless!
*** THIS ALMOST WORKS..., BUT IT'S RETURNING ALL DAYS MONDAY THROUGH SATURDAY
IN ONE TABLE. IT'S NOT SELECTING ONLY THE queryDay, AND IT'S NOT SHOWING
AVAILABLE OR UNAVAILABLE. IT RETURNS ALL AND LABELS ALL AS --TIME UNAVAILABLE--.
I APPRECIATE THE HELP YOU'VE GIVEN ME, AND WOULD UNDERSTAND AT THIS POINT
IF YOU BAILED OUT, BUT I THINK WE'RE CLOSE AND HOPE YOU WON'T. I'VE NEVER
DONE AN 'OUTER JOIN'; DIDN'T EVEN KNOW I COULD. I'M SELF TAUGHT, AND PROBABLY
WAY BEHIND.
strSQL = "SELECT dat.AvailableTime, ad.IsOkay" &_
" FROM DaysAndTimes dat Left Outer Join AppDetails ad" &_
" On dat.AvailableTime = ad.AppTime" &_
" and dat.TODAY = '" & request.querystring("queryDay") & "'" &_
" and ad.AppDate = '" & request.querystring("queryDate") & "'"
rstTimes.Open strSQL, DBConn

<%
i=i
do until rstTimes.EOF
%>
<form method="post" id="form1" name="form1"><TR>
<!-- IF REQUESTED TIME IS UNAVAILABLE -->
<% If Not isEmpty (rstTimes("IsOkay")) Then %>
<TD width="75" align="middle" height="30"><% Response.Write rstTimes("AvailableTime")
%></TD>
<TD width="450" height="30"><% Response.Write TheMessage1%>
<% Else %><TD width="75" align="middle" height="30"><% Response.Write rstTimes("AvailableTime")
%></TD>
<TD width="450" height="30"><INPUT id="Text1" type="text" name="Text1">
<IMG height="1" src="i/clear.gif" width="20">
<IMG height="1" src="i/clear.gif" width="15"> <INPUT id="Submit1" type="submit"
value="Submit" name="Submit1">
<IMG height="1" src="i/clear.gif" width="20">SELECT THIS TIME</TD>
<% End If %></TD>
</TR></form>
<%
rstTimes.MoveNext
loop
%>
[1983 byte] By [kyle] at [2007-11-9 17:50:31]
# 1 Re: looping - is making me loopy
It probably just needs some parentheses somewhere. Try this:

Select dat.AvailableTime, ad.IsOkay
From (DaysAndTimes dat Left Outer Join AppDetails ad
on dat.AvailableTime = add.AppTime)
where dat.Today = <day>
and ad.AppDate = <date>

Not sure how the where clause and the outer join work together -- might
need to move that "and ad.AppDate = <date>" inside the parens.

"kyle" <kfinch@bayoucitygroup.com> wrote in message
news:3ed60cd2$1@tnews.web.dev-archive.com...
>
> You're on the Christmas list regardless!
> *** THIS ALMOST WORKS..., BUT IT'S RETURNING ALL DAYS MONDAY THROUGH
SATURDAY
> IN ONE TABLE. IT'S NOT SELECTING ONLY THE queryDay, AND IT'S NOT
SHOWING
> AVAILABLE OR UNAVAILABLE. IT RETURNS ALL AND LABELS ALL AS --TIME
UNAVAILABLE--.
> I APPRECIATE THE HELP YOU'VE GIVEN ME, AND WOULD UNDERSTAND AT THIS
POINT
> IF YOU BAILED OUT, BUT I THINK WE'RE CLOSE AND HOPE YOU WON'T. I'VE
NEVER
> DONE AN 'OUTER JOIN'; DIDN'T EVEN KNOW I COULD. I'M SELF TAUGHT, AND
PROBABLY
> WAY BEHIND.
> strSQL = "SELECT dat.AvailableTime, ad.IsOkay" &_
> " FROM DaysAndTimes dat Left Outer Join AppDetails ad" &_
> " On dat.AvailableTime = ad.AppTime" &_
> " and dat.TODAY = '" & request.querystring("queryDay") & "'" &_
> " and ad.AppDate = '" & request.querystring("queryDate") & "'"
> rstTimes.Open strSQL, DBConn
>
> <%
> i=i
> do until rstTimes.EOF
> %>
> <form method="post" id="form1" name="form1"><TR>
> <!-- IF REQUESTED TIME IS UNAVAILABLE -->
> <% If Not isEmpty (rstTimes("IsOkay")) Then %>
> <TD width="75" align="middle" height="30"><% Response.Write
rstTimes("AvailableTime")
> %></TD>
> <TD width="450" height="30"><% Response.Write TheMessage1%>
> <% Else %><TD width="75" align="middle" height="30"><% Response.Write
rstTimes("AvailableTime")
> %></TD>
> <TD width="450" height="30"><INPUT id="Text1" type="text"
name="Text1">
> <IMG height="1" src="i/clear.gif" width="20">
> <IMG height="1" src="i/clear.gif" width="15"> <INPUT id="Submit1"
type="submit"
> value="Submit" name="Submit1">
> <IMG height="1" src="i/clear.gif" width="20">SELECT THIS TIME</TD>
> <% End If %></TD>
> </TR></form>
> <%
> rstTimes.MoveNext
> loop
> %>
Kris Eiben at 2007-11-11 23:16:54 >