Cint formatting in ASP Classic

Asked

Viewed 92 times

0

Good Afternoon to you... Guys, I have a question in formatting...

in my table, I have a column with nchar data(4) (before was nvarchar(4), but gave anyway), in the form users choose in a select to be able to fill and send to the table.

in this select, I have for example data "250", "1166", "2130" when I make a report on my web pag (in asc), and ask to sort, ascendingly, by the data in this column.. the 250 stands after the 1166, as if it were "2500", but in fact it must appear before, because the 250 must be considered as "0250".

put, in my ASC file, to format as formatnumber(Cint(data),"0000")

but it didn’t help.

someone knows how to fix?

thank you

1 answer

1


The problem is that you are using an invalid syntax for the function formatnumber.

What Voce has to do is add a PAD function like this:

Function PadDigits(val, digits)
  PadDigits = Right(String(digits,"0") & val, digits)
End Function

Then just use it this way:

PadDigits(dados,4)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.