example: strQ= "q1=1 or q2=2 or q3=4 .............q10 or" If q11=11 or q12=12 or q13=14 .............q20=20 then answer="happy" end if I want to have from q1=1 to q=20 as query My question is: how do we put strQ into the "if then" statement? If [ strQ ] q11=11 or q12=12 or q13=14 .............q20=20 then answer="happy" end if Thanks/ Reqards
This is a long way to do things. Try using an array: Dim q(20) For i = 1 to 20 If q(i) = i Then answer="happy" Next Code (markup): But if what you mean is to evaluate a string like: strQ = "q1=1 or q2=2" If strQ Then answer="happy" End If Code (markup): then I don't think that this can be done in ASP.
Sorry, yes it can. <% Dim strQ, q1, q2 q1 = 1 q2 = 5 strQ = "q1 = 1 OR q2 = 2" If Eval(strQ) Then Response.Write "happy" End If %> Code (markup):
Sorry, what I mean is: strQ= "q1=str1 or q2=str2 or q3=str4 .............q10=str10 or" If q11=str11 or q12=str12 or q13=str14 .............q20=str20 then answer="happy" end if I want to have from q1=str1 to q=str20 as query My question is: how do we put strQ into the "if then" statement? If [ strQ ] q11=str11 or q12=str12 or q13=str14 .............q20=str20 then answer="happy" end if I tried If & strQ & q11=str11 or q12=str12 or q13=str14 .............q20=str20 then but it was not working Thanks/ Reqards
use: If Eval(strq) [B]OR[/B] q11=str11 or q12=str12 .......... then Code (markup): But strq shouldn't end with OR it should just be: strQ= "q1=str1 or q2=str2 or q3=str4 .............q10=str10"
I still don't fully understand, but have you thought of using split(strq,"or") to give an array, and then working with that.