473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

if condition in asp

hi,
i facing a problem in asp

the code goes like this
thereare two different database.
i have to add multple combo in the page only if my one condition is true.

eg
Expand|Select|Wrap|Line Numbers
  1. var RepName;
  2.  
  3. RepName = "<%=ReportName%>"
  4.  
  5. <%
  6.  Set conn = Server.CreateObject("ADODB.Connection") 
  7.  conn.Open "'
  8.  Set rs = ""
  9.  
  10. If reportname = "ABC" then
  11.  
  12. %>
  13.  
  14. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  15.  
  16. <tr>
  17.     <td class="filterCol1" width="27%">
  18.     <b>Select Agency  : </b></td> 
  19.     <td class="filterCol2" width="73%">    
  20.         <Select name = "xyz" multiple ="true">
  21.         <option value= "all" selected="yes">Select All</option>
  22. <%
  23.  
  24. Do while not rs.eof
  25. name = rs("name")
  26. %>
  27.  <option value="<%= name %>"></option>
  28. <%
  29.  rs.MoveNext
  30. loop
  31. rs.close
  32. set rs=nothing
  33. %>
  34.  
  35. </select>
  36.     </td>
  37. </tr>
  38. </table>
  39. <% End if%>

if i remove if condition then it is working fine, but when i insert if nothing is display
when i debug the code the condition is true than to the table with combo is not displayed.
is there any problem in if statement
Oct 26 '07 #1
6 3827
jhardman
3,406 Expert 2GB
I don't see any problems. for troubleshooting you can add an else clause
Expand|Select|Wrap|Line Numbers
  1. else
  2.    response.write "reportName: " & reportName & "<br>" & vbNewLine
  3. end if
What does this give you?

I would advise to keep capitalization consistant. Even though vbScript is not case sensitive I think it helps (you refer to both "reportname" and "ReportName") but I don't think that will make any difference.

Let me know if this helps.

Jared
Oct 26 '07 #2
thanks for reply the problem has been resolved as the variable name was incorrect.

Well, i am facind one more problem can one page can have multple forms
and how to read that multple forms elements(combo)?
Oct 29 '07 #3
jhardman
3,406 Expert 2GB
Yes, a page can have multiple forms, but as far as I know there is no way to submit more than one form at a time. Tell me what you are trying and maybe I can suggest an alternative.

Jared
Oct 29 '07 #4
hi,
There are two forms in my asp page. one is having multiple elements like single combo, date etc. and other is having multple combo. On click of the submit button the all the value of both the forms pass to one page.
problem is that values of first forms are passed easily but other form which is having multple combo is not passed.
can you please help me? It's very urgent.
Oct 31 '07 #5
jhardman
3,406 Expert 2GB
hi,
There are two forms in my asp page. one is having multiple elements like single combo, date etc. and other is having multple combo. On click of the submit button the all the value of both the forms pass to one page.
problem is that values of first forms are passed easily but other form which is having multple combo is not passed.
can you please help me? It's very urgent.
why can't you put them all in one form?

Jared
Oct 31 '07 #6
markrawlingson
346 Expert 100+
As Jared said, there is no way to submit two forms at one time, only one or the other. The information from the other form isn't being lost - it's just not being sent.

What that means, essentially, is that if you have two forms on your page - a submit button will only submit the information in its parent form, the other information will NOT be passed to asp in the Request.Form object and therefore you can't access it on the next page.

It would be like a University professor giving out 2 assignments. The next day I submit only 1 assignment - He hasn't received the other assignment so he can't mark me on it because i didn't submit it.

If you want the information in both forms to be accessible on the second page, you will need to have 1 form, not 2.

Sincerely,
Mark
Oct 31 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kendal Goodrich | last post by:
In the setup project I am trying to create, I am wanting to search to see if DirectX 8 is installed on the local machine. I figured the best way to determine would be a registry key search, so I...
1
by: Joel | last post by:
As my registry start condition was working fine, now it's not working anymore Here are the kind of parameter I use in VSNEt2003: A) Registry : Name : Pipo; Property : PROP1; RegKey...
3
by: Ben R. | last post by:
In an article I was reading (http://www.ftponline.com/vsm/2005_06/magazine/columns/desktopdeveloper/), I read the following: "The ending condition of a VB.NET for loop is evaluated only once,...
3
by: Yohan | last post by:
Hello, I have a question concerning the template classes and their parameters. Is it possible to set a condition on the template parameters in a way that could block the compilation if the...
5
by: das | last post by:
hello all, this might be simple: I populate a temp table based on a condition from another table: select @condition = condition from table1 where id=1 in my stored procedure I want to do...
4
by: joh12005 | last post by:
Hello, i posted for suggestions a little idea even if it still needs further thoughts but as i'm sure you could help :) if would like to implement some kind of Condition class which i coud...
16
by: Claudio Grondi | last post by:
Sometimes it is known in advance, that the time spent in a loop will be in order of minutes or even hours, so it makes sense to optimize each element in the loop to make it run faster. One of...
3
by: jm.suresh | last post by:
Hi, I have a list and I want to find the first element that meets a condition. I do not want to use 'filter', because I want to come out of the iteration as soon as the first element is found. I...
4
by: Jane T | last post by:
I appreciate how difficult it is to resolve a problem without all the information but maybe someone has come across a similar problem. I have an 'extract' table which has 1853 rows when I ask for...
0
by: RN1 | last post by:
I have a DataGrid with an EditCommandColumn. In the EditCommand sub of the DataGrid, there is an If condition. This If condition is True for some rows in the DataGrid whereas it is False for the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.