[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

IF, THEN, ELSE working intermittently in Classic ASP

Asked by LZ1 in Active Server Pages (ASP)

Tags: asp

Hey Experts!!

I have a classic ASP application which I have written about prior.  My related solution is posted below as well.  I've determined that I need to filter the the information client-side.  
I'm at my witt's end with this thing and we will be switching over to a normalized DB and PHP soon. But for now I have to get this working.  

The major problem is that this code works on some variables but not others.  I can't figure it out.  When contact_CatSub_id is present or not equal to 0 then I want it to show the values of contact_first and contact_last columns.  However, if it's not, then I want it to check the other 3 columns.  Once it comes across a value, it should display the table data.  This is only happening with one account.  Please help!

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_24832671.html
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
*****SQL*******
SELECT DISTINCT Client.CatSub_id, contacts.contact_first, contacts.contact_last, contacts.contact2_first, contacts.contact2_last, contacts.contact3_first, contacts.contact3_last, contacts.contact4_first, contacts.contact4_last, contacts.contact_CatSub_id, contacts.contact2_CatSub_id, contacts.contact3_CatSub_id, contacts.contact4_CatSub_id
FROM (Contacts RIGHT JOIN Client ON Contacts.ACT_No=Client.ACT_no) LEFT JOIN Cat_Sub ON Client.CatSub_id=Cat_Sub.CatSub_id
WHERE cat_sub.catsub_id=MMColParam GROUP BY Client.CatSub_id, contacts.contact_first, contacts.contact_last, contacts.contact2_first, contacts.contact2_last, contacts.contact3_first, contacts.contact3_last, contacts.contact4_first, contacts.contact4_last, contacts.contact_CatSub_id, contacts.contact2_CatSub_id, contacts.contact3_CatSub_id, contacts.contact4_CatSub_id;
***asp****
    <%  If (rs_main.Fields.Item("contact_CatSub_id").Value) <> 0 Then%>
    The main contact for the district is: <%=(rs_main.Fields.Item("contact_first").Value)%> &nbsp; <%=(rs_main.Fields.Item("contact_last").Value)%>
  <% ElseIF  (rs_main.Fields.Item("contact2_CatSub_id").Value) = (rs_contact.Fields.Item("Cat_Sub.CatSub_id").Value) Then%>
    The main contact for the district is: <%=(rs_main.Fields.Item("contacts.contact2_first").Value)%> &nbsp; <%=(rs_main.Fields.Item("contacts.contact2_last").Value)%>
  <% ElseIF  (rs_main.Fields.Item("contact3_CatSub_id").Value) = (rs_contact.Fields.Item("Cat_Sub.CatSub_id").Value) Then%>
    The main contact for the district is: <%=(rs_main.Fields.Item("contact3_first").Value)%> &nbsp; <%=(rs_main.Fields.Item("contact3_last").Value)%>
  <% ElseIF  (rs_main.Fields.Item("contact4_CatSub_id").Value) = (rs_contact.Fields.Item("Cat_Sub.CatSub_id").Value) Then%>
    The main contact for the district is: <%=(rs_main.Fields.Item("contact4_first").Value)%> &nbsp; <%=(rs_main.Fields.Item("contact4_last").Value)%>
  <%Else %>
    n/a
  <%  End If%>
[+][-]10/26/09 05:30 PM, ID: 25668353Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/26/09 06:47 PM, ID: 25668600Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/26/09 11:21 PM, ID: 25669488Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/27/09 06:03 AM, ID: 25671889Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/27/09 06:06 AM, ID: 25671926Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/27/09 06:19 AM, ID: 25672050Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/09 05:59 AM, ID: 25719284Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/09 06:25 PM, ID: 25725626Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/09 10:05 PM, ID: 25736791Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 10:51 AM, ID: 25761895Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/07/09 06:01 AM, ID: 25766353Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/09 09:29 AM, ID: 25778016Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/17/09 04:56 PM, ID: 25845878Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625