Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some If....Then Help Please

Status
Not open for further replies.

minoad

Programmer
Mar 28, 2001
138
US
This may be an extremely elementary post, but i am having some issues with an if....then statement and was hoping someone else could see the error. Mayby i have just been sitting here to long and it is an obvious problem, but i have a webpage in which you may enter one or two search criteria in order to display the coresponding records. This is the problem code"
Dim strNme
Dim strTyp
Dim adoRS
Set Strname = Request.Querystring ("vtr")
Set strTyp = Request.Querystring ("lmn")
Set adoRS = server.createobject ("Adodb.Recordset")
adoRS.open sqltext, DSN="S215"
If strName > 0 Then Response.redirect_
(&quot;busDis.asp?vtr=<%=adoRS(&quot;bname&quot;)%>&quot;)
ElseIf strname = &quot;&quot; Then Sqltext=&quot;Select * From ABC_
Where btype = ('&quot; & lmn & &quot;')&quot; ;
End If

I have Removed some of the code for brevity in this post.
I would appreciate any help if you see the problem.

Thanks
Micah A. Norman
 
I see a semicolon up there that could come out -- don't need them for vbscript (or maybe you meant to put it inside the quotes so it wound up in your SQL statement??)

see if that helps --
 
Yes, sorry. Like i said was typing this post quickly. The semicolon should be inside of the quotes.

Thanks for pointing that out.

Micah A. Norman
 
I typed this post WAY to fast.

The strNme is not mistyped as strName. I only did that in the post.

Micah A. Norman
 
Are those continue _'s in your code?? If so, try taking them out -- I have always seen those here and there around the net and in examples, but I have NEVER had them work for me like they do in VB --

Also, take out the <%%>'s if this is already server side script --

If strName > 0 Then
Response.redirect(&quot;busDis.asp?vtr=&quot; & adoRS(&quot;bname&quot;) & &quot;)&quot;)
ElseIf strname = &quot;&quot; Then
Sqltext=&quot;Select * From ABC Where btype = ('&quot; & lmn & &quot;')&quot; ;
End If
 
The underscores were for the post to indicate &quot;Continued on Next Line&quot;.

Can you explain what you mean by taking out the <%,%>'s.

I am wondering if mayby the problem is in the &quot;if >0&quot; Statement. This will be returning text. Mayby it should be.. IF Len(&quot;strnme&quot;)>0 then....

Thanks for any help

Micah A. Norman
 
see up top where you are including the <%rs(&quot;fieldName&quot;)%> part, and where I omitted it?

From what you have posted, it looks like the whole thing is server side vbscript -- and so you don't need to use them - rather have the entire code block in them -- and rewrite that portion to resemble the example I posted.

and yes, I think your len idea would work the trick --
 
Thank you for the info. Going to try it shortly.
 
here is your problem:
you have strName > 0 where it should be strName <> &quot;&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top