Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:08 PM
Alistair
Guest
 
Posts: n/a
Default nested ifs and end ifs and elses

still working on this DB :o(

I have..

a query that I run, if this query is unsuccessful then another query is run
on another table, it goes something like this


if rs1.EOF then '1st query returns nothing

response.write "nothing in this table"

'so check the other table
strSQL = "SELECT * blah blah
rs.Open strSQL, Conn, 1

if rs.EOF then '2nd query also returns nothing
response.write "nothing in this table either"

else

do while not rs.EOF
reg = rs("reg_num")
l_read = rs("last_read")
response.write blah blah

end if

else

do while not rs1.EOF
strname = rs1("user_name")
response.write blah blah

rs1.movenext
loop

end if

but I get an expected statement (end if) error

I'm looking at my code it it seems to conform to the correct structure

if condition1 then
code block1
if condition2 then
codeblock2
else
codeblock3
end if
else
codeblock4
end if

should I perhaps have used elseif??


  #2  
Old July 19th, 2005, 01:08 PM
Alistair
Guest
 
Posts: n/a
Default Re: nested ifs and end ifs and elses

'tis ok.

I've found it....a missing loop

always find it after I post a request for help


  #3  
Old July 19th, 2005, 01:08 PM
F@yy@Z
Guest
 
Posts: n/a
Default Re: nested ifs and end ifs and elses

what about "loop" ?

loop syntex is missing in one of your do while statement. Try it may be it
works if not let us know.



"Alistair" <forget_it> wrote in message
news:109hgova96cmj10@corp.supernews.com...[color=blue]
> still working on this DB :o(
>
> I have..
>
> a query that I run, if this query is unsuccessful then another query is[/color]
run[color=blue]
> on another table, it goes something like this
>
>
> if rs1.EOF then '1st query returns nothing
>
> response.write "nothing in this table"
>
> 'so check the other table
> strSQL = "SELECT * blah blah
> rs.Open strSQL, Conn, 1
>
> if rs.EOF then '2nd query also returns nothing
> response.write "nothing in this table either"
>
> else
>
> do while not rs.EOF
> reg = rs("reg_num")
> l_read = rs("last_read")
> response.write blah blah
>
> end if
>
> else
>
> do while not rs1.EOF
> strname = rs1("user_name")
> response.write blah blah
>
> rs1.movenext
> loop
>
> end if
>
> but I get an expected statement (end if) error
>
> I'm looking at my code it it seems to conform to the correct structure
>
> if condition1 then
> code block1
> if condition2 then
> codeblock2
> else
> codeblock3
> end if
> else
> codeblock4
> end if
>
> should I perhaps have used elseif??
>
>[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles