Re: Replace: Problems stripping out Comma for a Integer field

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



In the end, I resorted to changing the data types in my table from INT to
VarChar......this will cause certain reporting and extraction challenges
later - oh well :)

<jason@xxxxxxxxxxxxxxx> wrote in message
news:udjWeAVtFHA.1168@xxxxxxxxxxxxxxxxxxxxxxx
> Interesting problem: If a user puts a Comma into an integer field I will
> get a data type error.
>
> I tried Replacing it with a blank space:
>
> FUNCTION FixApos(Var)
> FixApos=Replace(Var, "'", "")
> FixApos=Replace(Var, ",", "")
>
> END FUNCTION
>
> But still pick up the error. Is tis because the Int field sees the empty
> space as a 'character'?
>
> I have no resorted to redirecting user back to form page if there is a
> comma detected:
>
> FUNCTION FixApos(Var)
> FixApos=Replace(Var, "'", "")
> FixApos=Replace(Var, ",", "")
> If Instr(Var,",") then
>
> response.redirect "FormAdd.asp?Error=Comma"
>
> End If
> ' this replaces a single apostrophe ( ' ) with two single apostrophes (
> ''). Note: two single apostrophes, not one quotation mark
> END FUNCTION
>
>
> Bsides client side validation there surely has to be a better way to strip
> out commas for an integer field on the fly. I also tried replacing with a
> NULL but error said this was inproper use of Replace function.
>
> Could really use some help here.
>
> Thanks
> Jason
>


.



Relevant Pages

  • Re: gmpy moving to code.google.com
    ... raise TypeError, "You can interact Decimal only with int, long ... or Decimal data types." ... You can interact Decimal only with int, ... data types. ...
    (comp.lang.python)
  • Re: Almost!! Adding an ABOUT dialog
    ... I am not sure I understand your comments on the comma though! ... I never went back to using commas in declaration lists. ... the confusion of assiging 0 ...
    (microsoft.public.vc.mfc)
  • Re: Problem with reading an int with operator>>
    ... int n, m; ... if the two ints are separated by a comma. ... with the subject locale and streams on VC8 ... so that I dont use the precompiled dll? ...
    (microsoft.public.vc.stl)
  • Re: How to write better code for your projects ?
    ... >>it won't do any widening of data types. ... The compiler OTOH, thinks in terms of the internal word size ... > extern int x; ...
    (comp.arch.embedded)
  • Re: char vs int
    ... basic data types followed by any number of asterisks are unique data types? ... E.g. int * is as different from int *** as a char is from a double. ... > concept of pointers. ... > to pin down your difficulties, have a peek at the FAQ ...
    (comp.lang.c)