View Full Version : DB <> Veriable???
Morgoth
11-24-2002, 08:09 PM
My If statement:
If ooRS("UserName") = TFusername AND ooRS("EmailAddress") = TFemail AND ooRS("StaffLevel") = TFstafflevel AND ooRS("IDNumber") = TFIDnumber Then[b]
My Else Statment:
[b]Else
Response.Write "1 " & ooRS("UserName") & "<br>"
Response.Write "1 " & username & "<br>"
Response.Write "2 " & ooRS("EmailAddress") & "<br>"
Response.Write "2 " & email & "<br>"
Response.Write "3 " & ooRS("StaffLevel") & "<br>"
Response.Write "3 " & stafflevel & "<br>"
Response.Write "4 " & ooRS("IDNumber") & "<br>"
Response.Write "4 " & IDnumber
End If
When this script runs, the If statemnt is wrong, so it executes the else statement.
The else statsment results look like:
1 ME
1 ME
2 ME@email.com
2 ME@email.com
3 4
3 4
4 5554
4 5554
I don't know why it says my If statement is wrong when the veriables from the db and my memory are correct.
See anything? Know anything? Please help me.
whammy
11-24-2002, 08:26 PM
Have you written both variables out to make sure they really are the same?
Morgoth
11-24-2002, 08:30 PM
That is what this is:
Response.Write "1 " & ooRS("UserName") & "<br>"
Response.Write "1 " & username & "<br>"
Response.Write "2 " & ooRS("EmailAddress") & "<br>"
Response.Write "2 " & email & "<br>"
Response.Write "3 " & ooRS("StaffLevel") & "<br>"
Response.Write "3 " & stafflevel & "<br>"
Response.Write "4 " & ooRS("IDNumber") & "<br>"
Response.Write "4 " & IDnumber
They are the same, at the same time.
whammy
11-24-2002, 08:32 PM
Originally posted by Morgoth
If ooRS("UserName") = TFusername AND ooRS("EmailAddress") = TFemail AND ooRS("StaffLevel") = TFstafflevel AND ooRS("IDNumber") = TFIDnumber Then
My Else Statment:
[b]Else
Response.Write "1 " & ooRS("UserName") & "<br>"
Response.Write "1 " & username & "<br>"
Response.Write "2 " & ooRS("EmailAddress") & "<br>"
Response.Write "2 " & email & "<br>"
Response.Write "3 " & ooRS("StaffLevel") & "<br>"
Response.Write "3 " & stafflevel & "<br>"
Response.Write "4 " & ooRS("IDNumber") & "<br>"
Response.Write "4 " & IDnumber
End If
According to that, you're writing "username" not TFusername... etc. :)
Morgoth
11-24-2002, 10:03 PM
I changed that for this post, so that isn't the problem.
I just missed the TF on the ones int he if statement.
whammy
11-25-2002, 12:08 AM
Ok, that's cool... now you need to check which kind of variant you are getting back for each variable - perhaps you're comparing a string to a numeric value etc....
Check out:
VarType()
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctvartype.asp
Morgoth
11-25-2002, 02:44 AM
So your saying the best thing for me to do is take my ooRS() and save it as a string to match up with the other strings?
Or to check what vertype they are and tell you, and try to match them up if needed?
I will look at this thing and I will reply back in a matter of seconds.
Morgoth
11-25-2002, 02:51 AM
Ok, by the looks of this, I am unable to 'Dim' variables As Integers or LongIntegers.
I am stuck?
Instead of changing what it is in the database, how might I be able to change the variable type?
Morgoth
11-25-2002, 02:59 AM
CONVERT TO STRING!
cStr()
Thank you Whammy!
Mhtml
11-25-2002, 03:06 AM
DIM variables as INtergers or Long subtypes...this would mean that you are ttrying to do something like this...
123.33 = "THIS"
Why would you dimension the variable as a number?
Or am have I read what you have said wrong?
Morgoth
11-25-2002, 06:28 AM
If I declare anything at the top of my page
Dim Word1, Word2, Word3
Then it's automatically a String. I needed to change my Integer that was saved as a string into an Integer datatype so that it would read: Word = Word2 = True
And now because it was telling the system is was:
Word1 = "234" - String
Word2 = 234 - Integer
They didn't match.
I used
Word1 = cStr(Word2)
And it equaled True!
So it's done and I am happy now.
Understand MHTML?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.