Answer» Ok im trying to Learn how to Use ASP and VB Script and ive been Trying to Compair 2 Strings, so im useing the VB StrComp Function
it is Suposed to return a 0 if the Strings are the Same, or a -1 if there not.... or a 1 if there not
i cant Get it to Return 0, so the If is Never True
Code: [Select]<% UsrPass = "password" DataBaseRecord = "password" if(StrComp(UsrPass,DataBaseRecord) = 0) then response.write "Password Correct" & "<Br>" Else response.write "Password Incorrect" & "<Br>" End if %>
Never mind , it was my own Stupidityi don't have a ASP TESTING environment with me, but i coded this and RUN it USING wscript/cscript Code: [Select]Dim UsrPass Dim DataBaseRecord UsrPass = "password" DataBaseRecord = "password" if StrComp(UsrPass,DataBaseRecord) = 0 then MsgBox("0") Else MsgBox("1") End if
The output gives me "0". The difference is :
if(StrComp(UsrPass,DataBaseRecord) = 0)
becomes
if StrComp(UsrPass,DataBaseRecord) = 0
don't KNOW if it will solve your problem, but you could give it a tryFYI: there are four possible return CODES from strComp
string1 is less than string2 -1 string1 is equal to string2 0 string1 is greater than string2 1 string1 or string2 is Null Null
Just my 2¢
8-)
|