asp/vb programming

Dell Dell gaming backpack carrying case...
April 7, 2010 at 13:19:12
Specs: Windows XP

i am currently developing an asp page that file movement in a database, if a file is more than 5 minutes old i need it to show false, if a file is less than 5 minutes old it needs to be true, at present it works untill you get to the 10 minute mark, at which point it shows true again, it stays like this untill the file is 60 minutes old and then changes to false again, currently i have :

<%If (datediff("n",rs("processed"),(NOW))) < "5" Then response.write "" & "false" & "" else if rs("processed") = "" Then response.write "" & "false" & "" else response.write "" & "True" & "" end if%>

again when a file has not yet been processed there is no input but it still displays false

an ides?

See More: asp/vb programming

Report •

April 7, 2010 at 13:20:18
ps sorry about the bold writing, there is supposed to be font style defined between the "" but it appears to have take the code literally

Report •

April 7, 2010 at 14:15:23
This is way out of my league, but how about trying "05" instead of "5".

You probably should have posted in the 'Programming' forum, but there's a good chance that an expert will pop in here and answer your question.

Report •

April 7, 2010 at 14:51:33
Try rewriting the If/then statement along the following lines:

If (datediff("n",rs("processed"),(NOW))) < "5" OR rs("processed") = "" Then
response.write "" & "false"
response.write "" & "True" & "
end if

To many Else statements can only confuse the issue, especially when only one is required.

Or alternatively change the comparison to > 5 and adjust the True/False statements accordingly.


Report •

Related Solutions

April 11, 2010 at 14:48:03
cheers guys and sorry i am new to the whole forum thing, the two if statements are required because if there is no input it likes to state as true, im not sure why though

Report •

April 11, 2010 at 15:04:07
You don't need two if statement when there are only two possible outcomes. True or False. That is what the OR and AND logical operators were invented for. An If then else with the same outcome for both is bad programming.

You would only need two if Statements if the were three possible outcomes, True, False or Dont care.

What you are saying is the if the input is less than 5 or no input then the outcome of false. If the input is greater then five then the outcome is true. Only one If statement needed.

Your last post is at odds with your first post.


Report •

Ask Question