Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: if statement not working (javascript)


Message #1 by "James Garrett" <jhgarrett@e...> on Tue, 12 Feb 2002 12:11:40 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0023_01C1B3BE.6D855FA0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



I set up things with the following:



cmdYear =3D Server.CreateObject("ADODB.Command")

with(cmdYear){

 CommandText =3D strYear

 ActiveConnection =3D Conn

}

rsYear =3D Server.CreateObject("ADODB.Recordset")

 with(rsYear) {

 CusorLocation =3D adUseClient

 CursorType =3D adOpenStatic

 LockType =3D adLockReadOnly

 Opt =3D adCmdText

}

rsYear =3D cmdYear.Execute()

rsYear.movefirst()



cmdMonth =3D Server.CreateObject("ADODB.Command")

with(cmdMonth){

 CommandText =3D strYrMth

 ActiveConnection =3D Conn

}

rsMonth =3D Server.CreateObject("ADODB.Recordset")

with(rsMonth) {

 CusorLocation =3D adUseClient

 CursorType =3D adOpenStatic

 LockType =3D adLockReadOnly

 Opt =3D adCmdText

}

rsMonth =3D cmdMonth.Execute()



...



Then I stated:

if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {



}



This statement never evaluates to TRUE. I displayed both values prior to 

the if statement and saw that they were equal.



What could be the problem?



Thank you,

James










Message #2 by "Zee Computer Consulting" <zee@t...> on Tue, 12 Feb 2002 13:30:08 -0800
This is a multi-part message in MIME format.



------=_NextPart_000_0012_01C1B3C9.63707F80

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



I am having a little trouble understanding your code -- could you add 

some comments?



And maybe include all the code?



I would check the type and length of each database field as well as the 

content. Different field types could be a problem.







-- Z





  ----- Original Message -----

  From: James Garrett

  To: Access ASP

  Sent: Tuesday, February 12, 2002 9:11 AM

  Subject: [access_asp] if statement not working (javascript)





  I set up things with the following:



  cmdYear =3D Server.CreateObject("ADODB.Command")

  with(cmdYear){

   CommandText =3D strYear

   ActiveConnection =3D Conn

  }

  rsYear =3D Server.CreateObject("ADODB.Recordset")

   with(rsYear) {

   CusorLocation =3D adUseClient

   CursorType =3D adOpenStatic

   LockType =3D adLockReadOnly

   Opt =3D adCmdText

  }

  rsYear =3D cmdYear.Execute()

  rsYear.movefirst()



  cmdMonth =3D Server.CreateObject("ADODB.Command")

  with(cmdMonth){

   CommandText =3D strYrMth

   ActiveConnection =3D Conn

  }

  rsMonth =3D Server.CreateObject("ADODB.Recordset")

  with(rsMonth) {

   CusorLocation =3D adUseClient

   CursorType =3D adOpenStatic

   LockType =3D adLockReadOnly

   Opt =3D adCmdText

  }

  rsMonth =3D cmdMonth.Execute()



  ...



  Then I stated:

  if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {



  }



  This statement never evaluates to TRUE. I displayed both values prior 

to the if statement and saw that they were equal.



  What could be the problem?



  Thank you,

  James








$subst('Email.Unsub').






Message #3 by "Jeffrey Lee" <leech74@s...> on Wed, 13 Feb 2002 05:36:36 +0800
This is a multi-part message in MIME format.



------=_NextPart_000_00A5_01C1B450.671FDF90

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Are the values decimal?

If they are, then they may not be equal as it seems.

When you try to display the decimal values, the display value is 

accurate to a different accuracy than that of the actual value.



That means 2 numbers may not be equal when compare to the 10th decimal 

places but when compare @ the 9th decimal places they may be equal.

When displayed, they are in 9 decimal places but when the actual 

comparison is done by the codes, its 10 decimal places.



Need to know what are the values if this is not the case.

  ----- Original Message -----

  From: James Garrett

  To: Access ASP

  Sent: Wednesday, February 13, 2002 1:11 AM

  Subject: [access_asp] if statement not working (javascript)





  I set up things with the following:

  

  cmdYear =3D Server.CreateObject("ADODB.Command")

  with(cmdYear){

   CommandText =3D strYear

   ActiveConnection =3D Conn

  }

  rsYear =3D Server.CreateObject("ADODB.Recordset")

   with(rsYear) {

   CusorLocation =3D adUseClient

   CursorType =3D adOpenStatic

   LockType =3D adLockReadOnly

   Opt =3D adCmdText

  }

  rsYear =3D cmdYear.Execute()

  rsYear.movefirst()

  

  cmdMonth =3D Server.CreateObject("ADODB.Command")

  with(cmdMonth){

   CommandText =3D strYrMth

   ActiveConnection =3D Conn

  }

  rsMonth =3D Server.CreateObject("ADODB.Recordset")

  with(rsMonth) {

   CusorLocation =3D adUseClient

   CursorType =3D adOpenStatic

   LockType =3D adLockReadOnly

   Opt =3D adCmdText

  }

  rsMonth =3D cmdMonth.Execute()

  

  ...

  

  Then I stated:

  if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {

  

  }

  

  This statement never evaluates to TRUE. I displayed both values prior 

to the if statement and saw that they were equal.

  

  What could be the problem?

  

  Thank you,

  James

  

  




$subst('Email.Unsub').






Message #4 by "James Garrett" <jhgarrett@e...> on Tue, 12 Feb 2002 16:12:29 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_0086_01C1B3E0.11BF9920

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



There are no decimal values in these fields. They are number fields 

representing a year value, 2001.

  ----- Original Message -----

  From: Jeffrey Lee

  To: Access ASP

  Sent: Tuesday, February 12, 2002 4:36 PM

  Subject: [access_asp] Re: if statement not working (javascript)





  Are the values decimal?

  If they are, then they may not be equal as it seems.

  When you try to display the decimal values, the display value is 

accurate to a different accuracy than that of the actual value.



  That means 2 numbers may not be equal when compare to the 10th decimal 

places but when compare @ the 9th decimal places they may be equal.

  When displayed, they are in 9 decimal places but when the actual 

comparison is done by the codes, its 10 decimal places.



  Need to know what are the values if this is not the case.

    ----- Original Message -----

    From: James Garrett

    To: Access ASP

    Sent: Wednesday, February 13, 2002 1:11 AM

    Subject: [access_asp] if statement not working (javascript)





    I set up things with the following:



    cmdYear =3D Server.CreateObject("ADODB.Command")

    with(cmdYear){

     CommandText =3D strYear

     ActiveConnection =3D Conn

    }

    rsYear =3D Server.CreateObject("ADODB.Recordset")

     with(rsYear) {

     CusorLocation =3D adUseClient

     CursorType =3D adOpenStatic

     LockType =3D adLockReadOnly

     Opt =3D adCmdText

    }

    rsYear =3D cmdYear.Execute()

    rsYear.movefirst()



    cmdMonth =3D Server.CreateObject("ADODB.Command")

    with(cmdMonth){

     CommandText =3D strYrMth

     ActiveConnection =3D Conn

    }

    rsMonth =3D Server.CreateObject("ADODB.Recordset")

    with(rsMonth) {

     CusorLocation =3D adUseClient

     CursorType =3D adOpenStatic

     LockType =3D adLockReadOnly

     Opt =3D adCmdText

    }

    rsMonth =3D cmdMonth.Execute()



    ...



    Then I stated:

    if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {



    }



    This statement never evaluates to TRUE. I displayed both values 

prior to the if statement and saw that they were equal.



    What could be the problem?



    Thank you,

    James








$subst('Email.Unsub').




$subst('Email.Unsub').






Message #5 by "Jeffrey Lee" <leech74@s...> on Wed, 13 Feb 2002 06:37:30 +0800
This is a multi-part message in MIME format.



------=_NextPart_000_01EC_01C1B458.E9100EF0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) is javascript.



I presume the rest are asp or server codes.



Where did you check the values of the abovementioned statement?  

Immediately before the line itself using javascript?

Try if (<%=3DrsMonth("CAL_YEAR")%> =3D=3D <%=3DrsYear("CAL_YEAR")%>)

  ----- Original Message -----

  From: James Garrett

  To: Access ASP

  Sent: Wednesday, February 13, 2002 5:12 AM

  Subject: [access_asp] Re: if statement not working (javascript)





  There are no decimal values in these fields. They are number fields 

representing a year value, 2001.

    ----- Original Message -----

    From: Jeffrey Lee

    To: Access ASP

    Sent: Tuesday, February 12, 2002 4:36 PM

    Subject: [access_asp] Re: if statement not working (javascript)





    Are the values decimal?

    If they are, then they may not be equal as it seems.

    When you try to display the decimal values, the display value is 

accurate to a different accuracy than that of the actual value.



    That means 2 numbers may not be equal when compare to the 10th 

decimal places but when compare @ the 9th decimal places they may be 

equal.

    When displayed, they are in 9 decimal places but when the actual 

comparison is done by the codes, its 10 decimal places.



    Need to know what are the values if this is not the case.

      ----- Original Message -----

      From: James Garrett

      To: Access ASP

      Sent: Wednesday, February 13, 2002 1:11 AM

      Subject: [access_asp] if statement not working (javascript)





      I set up things with the following:

      

      cmdYear =3D Server.CreateObject("ADODB.Command")

      with(cmdYear){

       CommandText =3D strYear

       ActiveConnection =3D Conn

      }

      rsYear =3D Server.CreateObject("ADODB.Recordset")

       with(rsYear) {

       CusorLocation =3D adUseClient

       CursorType =3D adOpenStatic

       LockType =3D adLockReadOnly

       Opt =3D adCmdText

      }

      rsYear =3D cmdYear.Execute()

      rsYear.movefirst()

      

      cmdMonth =3D Server.CreateObject("ADODB.Command")

      with(cmdMonth){

       CommandText =3D strYrMth

       ActiveConnection =3D Conn

      }

      rsMonth =3D Server.CreateObject("ADODB.Recordset")

      with(rsMonth) {

       CusorLocation =3D adUseClient

       CursorType =3D adOpenStatic

       LockType =3D adLockReadOnly

       Opt =3D adCmdText

      }

      rsMonth =3D cmdMonth.Execute()

      

      ...

      

      Then I stated:

      if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {

      

      }

      

      This statement never evaluates to TRUE. I displayed both values 

prior to the if statement and saw that they were equal.

      

      What could be the problem?

      

      Thank you,

      James

      

      




$subst('Email.Unsub').




$subst('Email.Unsub').




$subst('Email.Unsub').






Message #6 by "Caroline & Hossein" <mach3@w...> on Tue, 12 Feb 2002 23:49:57 +0100
This is a multi-part message in MIME format.



------=_NextPart_000_0014_01C1B41F.FA22B910

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Hi

To hard to answer. But are you trying to write ASP? this is not the way!



Fex:    Set cmdYear =3D Server.CreateObject("ADODB.Command")



and so on



Regards

Hossein





  ----- Original Message -----

  From: James Garrett

  To: Access ASP

  Sent: Tuesday, February 12, 2002 6:11 PM

  Subject: [access_asp] if statement not working (javascript)





  I set up things with the following:



  cmdYear =3D Server.CreateObject("ADODB.Command")

  with(cmdYear){

   CommandText =3D strYear

   ActiveConnection =3D Conn

  }

  rsYear =3D Server.CreateObject("ADODB.Recordset")

   with(rsYear) {

   CusorLocation =3D adUseClient

   CursorType =3D adOpenStatic

   LockType =3D adLockReadOnly

   Opt =3D adCmdText

  }

  rsYear =3D cmdYear.Execute()

  rsYear.movefirst()



  cmdMonth =3D Server.CreateObject("ADODB.Command")

  with(cmdMonth){

   CommandText =3D strYrMth

   ActiveConnection =3D Conn

  }

  rsMonth =3D Server.CreateObject("ADODB.Recordset")

  with(rsMonth) {

   CusorLocation =3D adUseClient

   CursorType =3D adOpenStatic

   LockType =3D adLockReadOnly

   Opt =3D adCmdText

  }

  rsMonth =3D cmdMonth.Execute()



  ...



  Then I stated:

  if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {



  }



  This statement never evaluates to TRUE. I displayed both values prior 

to the if statement and saw that they were equal.



  What could be the problem?



  Thank you,

  James








$subst('Email.Unsub').






Message #7 by "James Garrett" <jhgarrett@e...> on Tue, 12 Feb 2002 16:48:02 -0500
This is a multi-part message in MIME format.



------=_NextPart_000_00D2_01C1B3E5.0943B740

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



I am using JavaScript. Your fix is for VBScript.



Thank you,

James

  ----- Original Message -----

  From: Caroline & Hossein

  To: Access ASP

  Sent: Tuesday, February 12, 2002 5:49 PM

  Subject: [access_asp] Re: if statement not working (javascript)





  Hi

  To hard to answer. But are you trying to write ASP? this is not the 

way!



  Fex:    Set cmdYear =3D Server.CreateObject("ADODB.Command")



  and so on



  Regards

  Hossein





    ----- Original Message -----

    From: James Garrett

    To: Access ASP

    Sent: Tuesday, February 12, 2002 6:11 PM

    Subject: [access_asp] if statement not working (javascript)





    I set up things with the following:



    cmdYear =3D Server.CreateObject("ADODB.Command")

    with(cmdYear){

     CommandText =3D strYear

     ActiveConnection =3D Conn

    }

    rsYear =3D Server.CreateObject("ADODB.Recordset")

     with(rsYear) {

     CusorLocation =3D adUseClient

     CursorType =3D adOpenStatic

     LockType =3D adLockReadOnly

     Opt =3D adCmdText

    }

    rsYear =3D cmdYear.Execute()

    rsYear.movefirst()



    cmdMonth =3D Server.CreateObject("ADODB.Command")

    with(cmdMonth){

     CommandText =3D strYrMth

     ActiveConnection =3D Conn

    }

    rsMonth =3D Server.CreateObject("ADODB.Recordset")

    with(rsMonth) {

     CusorLocation =3D adUseClient

     CursorType =3D adOpenStatic

     LockType =3D adLockReadOnly

     Opt =3D adCmdText

    }

    rsMonth =3D cmdMonth.Execute()



    ...



    Then I stated:

    if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {



    }



    This statement never evaluates to TRUE. I displayed both values 

prior to the if statement and saw that they were equal.



    What could be the problem?



    Thank you,

    James








$subst('Email.Unsub').




$subst('Email.Unsub').






Message #8 by "Mohamed Abdelaziz" <maziz7@h...> on Wed, 13 Feb 2002 16:28:38
> This is a multi-part message in MIME format.

> 

> ------=_NextPart_000_0023_01C1B3BE.6D855FA0

> Content-Type: text/plain;

> 	charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

> 

> I set up things with the following:

> 

> cmdYear =3D Server.CreateObject("ADODB.Command")

> with(cmdYear){

>  CommandText =3D strYear

>  ActiveConnection =3D Conn

> }

> rsYear =3D Server.CreateObject("ADODB.Recordset")

>  with(rsYear) {

>  CusorLocation =3D adUseClient

>  CursorType =3D adOpenStatic

>  LockType =3D adLockReadOnly

>  Opt =3D adCmdText

> }

> rsYear =3D cmdYear.Execute()

> rsYear.movefirst()

> 

> cmdMonth =3D Server.CreateObject("ADODB.Command")

> with(cmdMonth){

>  CommandText =3D strYrMth

>  ActiveConnection =3D Conn

> }

> rsMonth =3D Server.CreateObject("ADODB.Recordset")

> with(rsMonth) {

>  CusorLocation =3D adUseClient

>  CursorType =3D adOpenStatic

>  LockType =3D adLockReadOnly

>  Opt =3D adCmdText

> }

> rsMonth =3D cmdMonth.Execute()

> 

> ...

> 

> Then I stated:

> if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) {

> 

> }

> 

> This statement never evaluates to TRUE. I displayed both values prior to 



> the if statement and saw that they were equal.

> 

> What could be the problem?

> 

> Thank you,

> James

> 

> 

> 

> ------=_NextPart_000_0023_01C1B3BE.6D855FA0

> Content-Type: text/html;

> 	charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

> 

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

> <HTML><HEAD>

> <META http-equiv=3DContent-Type content=3D"text/html; 

> charset=3Diso-8859-1">

> <META content=3D"MSHTML 5.50.4912.300" name=3DGENERATOR>

> <STYLE></STYLE>

> </HEAD>

> <BODY bgColor=3D#ffffff>

> <DIV><FONT size=3D2>I set up things with the following:</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>cmdYear =3D

> Server.CreateObject("ADODB.Command")<BR>with(cmdYear)

{<BR>&nbsp;CommandTe

> xt =3D

> strYear<BR>&nbsp;ActiveConnection =3D Conn<BR>}<BR>rsYear =3D

> Server.CreateObject("ADODB.Recordset")<BR>&nbsp;with(rsYear)

> {<BR>&nbsp;CusorLocation =3D adUseClient<BR>&nbsp;CursorType =3D

> adOpenStatic<BR>&nbsp;LockType =3D adLockReadOnly<BR>&nbsp;Opt =3D

> adCmdText<BR>}<BR>rsYear =3D 

> cmdYear.Execute()<BR>rsYear.movefirst()</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>cmdMonth =3D

> Server.CreateObject("ADODB.Command")<BR>with(cmdMonth)

{<BR>&nbsp;CommandT

> ext =3D

> strYrMth<BR>&nbsp;ActiveConnection =3D Conn<BR>}<BR>rsMonth =3D

> Server.CreateObject("ADODB.Recordset")<BR>with(rsMonth) 

> {<BR>&nbsp;CusorLocation

> =3D adUseClient<BR>&nbsp;CursorType =3D adOpenStatic<BR>&nbsp;LockType 

> =3D

> adLockReadOnly<BR>&nbsp;Opt =3D adCmdText<BR>}<BR>rsMonth =3D

> cmdMonth.Execute()</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>...</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>Then I stated:</FONT></DIV>

> <DIV><FONT size=3D2>if (rsMonth("CAL_YEAR") =3D=3D rsYear("CAL_YEAR")) 

> {</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>}</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>This statement never evaluates to TRUE. I displayed 

> both

> values prior to the if statement and saw that they were equal. 

> </FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>What could be the problem?</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>Thank you,</FONT></DIV>

> <DIV><FONT size=3D2>James</FONT></DIV>

> <DIV><FONT size=3D2></FONT>&nbsp;</DIV>

> <DIV><FONT size=3D2>&nbsp;</FONT></DIV></BODY></HTML>

> 

> ------=_NextPart_000_0023_01C1B3BE.6D855FA0--

> 


  Return to Index