Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   number format (http://www.velocityreviews.com/forums/t804498-number-format.html)

M. Savas Zorlu 09-23-2008 09:36 AM

number format
 
Hi,

Our thousand seperator is period, and decimal seperator is comma.

so a number looks like this: 1.456,60

formatnumber() produces above format.

When entering this value into database, I get error, because comma is
also used by SQL to separate records.

If the number is smaller than thousand, I can solve thi sby replacing
comma with period. but when the number is thousand or greater, I cant
fix it.

Can anyone tell me a workaround for this please?


Anthony Jones 09-23-2008 01:06 PM

Re: number format
 
"M. Savas Zorlu" <savas@zorlumail.com> wrote in message
news:O0iYd$VHJHA.3668@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> Our thousand seperator is period, and decimal seperator is comma.
>
> so a number looks like this: 1.456,60
>
> formatnumber() produces above format.
>
> When entering this value into database, I get error, because comma is also
> used by SQL to separate records.
>
> If the number is smaller than thousand, I can solve thi sby replacing
> comma with period. but when the number is thousand or greater, I cant fix
> it.
>
> Can anyone tell me a workaround for this please?
>



Stop using formatnumber for this job. Also you are probably using string
contentation to build up your SQL string including the parameter. Stop
doing that as well. Use a command object and add parameters for the
appropriate type.



--
Anthony Jones - MVP ASP/ASP.NET


M. Savas Zorlu 09-23-2008 01:21 PM

Re: number format
 
Hi Anthony,

Can you please explain string contentation? and can you please give an
example of using a command object?

regards,

Savas

Anthony Jones wrote:
> "M. Savas Zorlu" <savas@zorlumail.com> wrote in message
> news:O0iYd$VHJHA.3668@TK2MSFTNGP05.phx.gbl...
>> Hi,
>>
>> Our thousand seperator is period, and decimal seperator is comma.
>>
>> so a number looks like this: 1.456,60
>>
>> formatnumber() produces above format.
>>
>> When entering this value into database, I get error, because comma is
>> also used by SQL to separate records.
>>
>> If the number is smaller than thousand, I can solve thi sby replacing
>> comma with period. but when the number is thousand or greater, I cant
>> fix it.
>>
>> Can anyone tell me a workaround for this please?
>>

>
>
> Stop using formatnumber for this job. Also you are probably using
> string contentation to build up your SQL string including the
> parameter. Stop doing that as well. Use a command object and add
> parameters for the appropriate type.
>
>
>


Anthony Jones 09-23-2008 01:32 PM

Re: number format
 
"M. Savas Zorlu" <savas@zorlumail.com> wrote in message
news:u06eP9XHJHA.3548@TK2MSFTNGP05.phx.gbl...
> Hi Anthony,
>
> Can you please explain string contentation?


sSQL = "UPDATE myTable SET myField = " & myNumber

The problem is if myNumber is ultimately supplied by the client a malicious
person can inject SQL code that will do bad things. Search google for SQL
Injection.

> and can you please give an example of using a command object?
>


See this:-
http://msdn.microsoft.com/en-us/library/ms524771.aspx

--
Anthony Jones - MVP ASP/ASP.NET


M. Savas Zorlu 09-23-2008 06:13 PM

Re: number format
 
Thanks Anthony

Anthony Jones wrote:
> "M. Savas Zorlu" <savas@zorlumail.com> wrote in message
> news:u06eP9XHJHA.3548@TK2MSFTNGP05.phx.gbl...
>> Hi Anthony,
>>
>> Can you please explain string contentation?

>
> sSQL = "UPDATE myTable SET myField = " & myNumber
>
> The problem is if myNumber is ultimately supplied by the client a
> malicious person can inject SQL code that will do bad things. Search
> google for SQL Injection.
>
>> and can you please give an example of using a command object?
>>

>
> See this:-
> http://msdn.microsoft.com/en-us/library/ms524771.aspx
>



All times are GMT. The time now is 06:46 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57