Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Search page

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,52864
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Search page
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Search page - 10/20/2007 8:24:53 PM   
  hnikou

 

Posts: 3
Score: 0
Joined: 10/20/2007
Status: offline
I've a database with four fileds Txt1, Txt2, Pdate1 & pdate2. The two first fields are text and the others are date. I am using a search page that send Query.string to look for specific entry of Txt1 and Txt2. My question is how to show just the results dependent to appropriate pdate1 and pdate2.e.g.:I wrote the line below but no results as i needed. I want this algoritm: If( Txt1 is valid and date1 is greater than today ) OR (Txt2 is valid and date2 is greater than today )  write something. 

<% if (rs.Fields.Item("Txt1").Value) = Request.QueryString( "QueryString" ) and (rs.Fields.Item("pdate1").Value) > date()
Or  if (rs.Fields.Item("Txt2").Value) = Request.QueryString( "QueryString" ) and (rs.Fields.Item("pdate2").Value) > date() Then
Response.Write " something"
End If
rs.MoveNext
Loop
%>

Thanks in advanced.
Henry

< Message edited by hnikou -- 10/20/2007 8:40:03 PM >
 
 
Post #: 1
 
 RE: Search page - 10/20/2007 11:00:49 PM   
  ehvbs

 

Posts: 2012
Score: 48
Joined: 6/22/2005
From: Germany
Status: offline
Hi hnikou,

There is a syntax error in your statement:

... date() Or  if (rs.Field ...

Putting brackets around a simple term like

... (rs.Fields.Item("Txt1").Value)

doesn't make much sense; it would be better to bracket the subexpressions to
avoid surprises by operator precendence:

If ( b1 And b2 ) Or ( b3 And b4 ) Then

You could use temporary variables to make the If expression more lucid:

sExpectedText = Request.QueryString( "QueryString" )
  bFirstCase = rs.Fields.Item("Txt1").Value = sExpectedText 
bFirstCase = bFirstCase And ( rs.Fields.Item("pdate1").Value > date() )
...
If bFirstCase Or bSecondCase Then
...

Good luck!

ehvbs

(in reply to hnikou)
 
 
Post #: 2
 
 RE: Search page - 10/22/2007 10:24:09 PM   
  hnikou

 

Posts: 3
Score: 0
Joined: 10/20/2007
Status: offline
Hi ehvbs,
Thanks alot for your comment. My problem has been solved by your comments.
Wishes
hnikou 

(in reply to ehvbs)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Search page Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts