Home > Archive > microsoft.public.sqlserver.server > October 2002 > ASP & Regional Setting





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ASP & Regional Setting
frankiexy

2002-10-05, 9:12 pm

Dear all,

I use ASP to display the content of a table on web. But I found that the
leading zero didn¡¯t be showed. For example, 0.001 will be showed as .001.

I perform the following actions, and found that:

1. I change Regional Options of the IIS server machine (also the SQL Server
machine) to display leading zero, and I can see 0.001 in database and web
now. But only on this server.

2. I change Regional Options on some clients, found that some of them can
show leading zero, some of them cannot.

3. I change DSN setting to use Regional Setting on the server, so every
client can show leading zero.

Now my questions are:

1. What decides the display mode? Client setting or server setting?

2. If I don¡¯t use DSN but use OLE DB, how to let it use Regional
Setting?

Thank you for your help!

Frankie.



frankiexy

2002-10-05, 9:13 pm

Hi Mario,

Response.Write(CStr(myvalue)) doesn't work.
Can you advise?

Thanks,

Frankie.

"Mario Figueiredo" <marfig@netcabo.pt> wrote in message
news:561c01c2623a$d5e70eb0$35e
f2ecf@TKMSFTNGXA11...
Hello Franky,

I would have to make some tests on this one, but of the
top of my head,

The last word belongs to the client browser. His machine
alone can determine and override any settings you setup on
your server(s) and even ODBC (for all that matters, the
client on your ODBC connection is your IIS, not the user
machine).

What I suggest is for your to setup your servers and ODBC
in order to omit the leading zero and then, to trick the
client machine, pass the values as strings:

Instead of, Response.Write(myvalue)
you should, Response.Write(CStr(myvalue))

This way the regional settings and conversion to string
happens on your IIS server and the client browser will not
attempt to apply regional settings on a string.

Hope this helps,
Mario Figueiredo



Mario Figueiredo

2002-10-05, 9:13 pm

Hi Franky,

hmm... plan B. This one should work.
Format your number before passing it to the client with
the FormatNumber function.
Something like FormatNumber(myValue, -1, 0) will format
myValue with the any digits to the right of the decimal,
and no leading zero. Voila! (2, instead of -1, for
instance, will set 2 digits to the right of the decimal)

Check this function on your favorite VBScript reference.
Just note that all parameters (except for the 1st one, of
course) have their defaults set to -1 (which means, use
regional settings).

The full syntax is:
FormatNumber(Expression [,NumDigitsAfterDecimal
[,IncludeLeadingDigit [,UseParensForNegativeNumbers
[,GroupDigits]]]])

IncludeLeadingDigit, the second parameter, can be 0, 1, -
1. For False, True or Use Regional Settings, respectively.

If this one still fails, which it shouldn't, wrap the
whole thing inside the CStr() function of Plan A and it
should be ok.

Also note that the FormatNumber() function completely
overrides your regional settings. So you can set them back
to what you are most comfortable with.

Finally, although this may work, I'm still confused as to
why after you changing your regional settings and
converting the value to a string before passing it to the
client browser, it still overrides your server regional
settings. You don't have to reply, but are you sure you
are setting your regional settings on the IIS machine?
Aren't you doing this on the SQL server? Because it should
be the former.

Regards,
Mario

>-----Original Message-----
>Hi Mario,
>
>Response.Write(CStr(myvalue)) doesn't work.
>Can you advise?
>
>Thanks,
>
>Frankie.
>
>"Mario Figueiredo" <marfig@netcabo.pt> wrote in message
> news:561c01c2623a$d5e70eb0$35e
f2ecf@TKMSFTNGXA11...
>Hello Franky,
>
>I would have to make some tests on this one, but of the
>top of my head,
>
>The last word belongs to the client browser. His machine
>alone can determine and override any settings you setup on
>your server(s) and even ODBC (for all that matters, the
>client on your ODBC connection is your IIS, not the user
>machine).
>
>What I suggest is for your to setup your servers and ODBC
>in order to omit the leading zero and then, to trick the
>client machine, pass the values as strings:
>
>Instead of, Response.Write(myvalue)
>you should, Response.Write(CStr(myvalue))
>
>This way the regional settings and conversion to string
>happens on your IIS server and the client browser will not
>attempt to apply regional settings on a string.
>
>Hope this helps,
>Mario Figueiredo
>
>
>
>.
>

Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net