Comparing variables

Results 1 to 7 of 7

Thread: Comparing variables

  1. #1
    JustinS Guest

    Default Comparing variables

    Hiyas all,<BR><BR>I am having problems with the line below. It refuses to compare the contents of rs("reversed") and reversed. I have outputted the contents of both numeric variables within the loop and they _do_ match (and no reversed shouldn&#039t have a (count) after it ;)<BR><BR>If I change the field "reversed" in the MS Access database to a text field the code executes properly, if however "reversed" is left as a number field then the code does not find a match. =(<BR><BR>If Rs("agentname") = agentname(count) AND Rs("reversed") = reversed Then<BR><BR>I have tried using various symbols around Rs("reversed") such as &#039 and # but either the code does not execute or I get a syntax error.<BR><BR>Any/All help is greatly appreciated,<BR><BR>Cheers,<BR><BR>Justin

  2. #2 Guest

    Default RE: Comparing variables

    When you compare use the cint (convert to int) and cstr (convert to string)<BR>you can&#039t compare ints with strings :)<BR><BR>greets<BR>Jeff

  3. #3
    JustinS Guest

    Default RE: Comparing variables

    Cheers Jeff =)<BR><BR>Sounds like just what I need - I just tried using it and am getting the following no matter what syntax I seem to use -<BR><BR>Overflow: &#039cint&#039<BR><BR>Cheers,<BR><BR>Justin

  4. #4 Guest

    Default RE: Comparing variables

    that weird... try putting both variables on the screen.<BR>or try comparing with strings only.<BR>let me know if it works<BR><BR>greets<BR>Jeff

  5. #5
    JustinS Guest

    Default RE: Comparing variables

    Just done that Jeff ;) - I added the following code to the loop to see what the hell was going on =)<BR><BR> Response.Write(reversed) & "&#060;PR&#062;"<BR> Response.Write(CRset("reversed")) & "&#060;P&#062;"<BR><BR>Note: I changed the BR to PR because the board actually replaced it with a line break :P<BR><BR>Here is exactly what was printed on the screen for the values of reversed and CRset("reversed")<BR><BR>20000119<BR>20000119<BR>< BR>20000119<BR>20000119<BR><BR>20000119<BR>2000011 9<BR><BR>Strange eh? And yet if I change the "reversed" field in the database the code works perfectly. If you think it&#039d make it easier or give you a clearer picture I can mail you the whole page directly or post it on here (it is quite long - 189lines).<BR><BR>Cheers for your ongoing help Jeff =)<BR><BR>Justin

  6. #6
    Bobby Guest

    Default RE: Comparing variables

    Try using cLng(your varaible)<BR><BR>it may help

  7. #7
    JustinS Guest

    Default RE: Comparing variables

    Ok I&#039ve tried CLng&#039ing both of the variables but got the following error -<BR><BR>Variable uses an Automation type not supported in VBScript: &#039cLng&#039<BR><BR>My code (tried within and outside the loop) was -<BR><BR>cLng(reversed)<BR>cLng(reversed(count))<BR ><BR>I&#039m pretty much back to where I started - the page works _perfectly_ if the "reversed" field in the database is a text field, but it isn&#039t supposed to be and this does affect other pages =(<BR><BR>Once I set the field to be a Number type this line of code gets ignored - <BR><BR>If CRset CRset("reversed") = reversed AND CRset("login") = login(count) Then<BR> verifyflag = verifyflag +1<BR>End If<BR><BR>The If statement does compare other values (all of a text type) without any problem whatsoever.<BR><BR>Help, someone, pleaase ;)<BR><BR>Cheers,<BR><BR>Justin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts