Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > number format

Reply
Thread Tools

number format

 
 
M. Savas Zorlu
Guest
Posts: n/a
 
      09-23-2008
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?

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      09-23-2008
"M. Savas Zorlu" <(E-Mail Removed)> wrote in message
news:O0iYd$(E-Mail Removed)...
> 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

 
Reply With Quote
 
 
 
 
M. Savas Zorlu
Guest
Posts: n/a
 
      09-23-2008
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" <(E-Mail Removed)> wrote in message
> news:O0iYd$(E-Mail Removed)...
>> 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.
>
>
>

 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      09-23-2008
"M. Savas Zorlu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

 
Reply With Quote
 
M. Savas Zorlu
Guest
Posts: n/a
 
      09-23-2008
Thanks Anthony

Anthony Jones wrote:
> "M. Savas Zorlu" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Using %x to format number to hex and number of digits Tim Chase Python 2 11-06-2010 01:22 AM
Re: Using %x to format number to hex and number of digits Chris Rebert Python 1 11-05-2010 07:05 PM
binary number format ? format character %b or similar. Ken Starks Python 4 06-23-2008 08:59 AM
converting exponential format number to decimal format number Fei Liu Perl Misc 21 12-16-2006 01:49 AM
XSLT error with number and format-number functions silellak@gmail.com XML 1 09-18-2006 11:08 PM



Advertisments