ASP LEN/IsNumeric Problem.

Results 1 to 2 of 2

Thread: ASP LEN/IsNumeric Problem.

  1. #1
    Join Date
    Dec 1969

    Default ASP LEN/IsNumeric Problem.

    Hi Folks,<BR> I have a search directory located at However I am having some problems with some of the code. It is very strange as it did work in the past and then suddenly ceased working.<BR> What the code does is allow one to edit a link and part of the editing can include moving a link from one category to another. Now in order to do that what the script does is generates a list of categories, their category ids, and their parent category id. The individual updating the link selects from the drop down box which category they desire. This code is then passed to the next page which actually carries out the command. It fulfills the command by doing a LEN on the option selected for the category (b/c the value is not simply the parent category id it is moving to but as mentioned about its own id, name (text), and parent category id). Using this LEN it then moves from the right to the left finding the numeric expressions till it hits a non-numeric expression. This is the category number. It then is supposed to update the links parent category id in the database with the number found, however instead it seems to be generating non-random negative numbers. Here is the code that I believe is creating the problem:<BR>Dim txtLinkCategoryIDvar<BR>Dim CategoryNumber<BR>Dim CategorySame<BR>Dim i<BR><BR>CategoryNumber = txtLinkCategory<BR>txtLinkCategoryIDvar=0<BR>For i = LEN(CategoryNumber) To 1 Step - 1<BR> If IsNumeric(Left(CategoryNumber, i)) Then<BR> txtLinkCategoryIDvar = CLNG(Left(CategoryNumber, i))<BR> Exit For<BR>End If<BR> Next<BR><BR>Respectfully,<BR>David Mackey.

  2. #2
    Join Date
    Dec 1969

    Default Suggested before...

    ...that you DEBUG DEBUG DEBUG this.<BR><BR>And I *did* point out that <BR> -371PF<BR>*would* give you a numeric value of<BR> -371<BR><BR>And what happens if the supposed category number is<BR> XYZQ<BR>??? You have no error check for that, so your value will end up being zero.<BR><BR>Still don&#039;t like txtXXX for a numeric variable. Ugh.<BR>

Posting Permissions

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