473,511 Members | 16,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detailsview shows real numbers with commata: Error converting data type nvarchar to real!

Hello,

if have an asp.net web page with a detailsview. This detailsview uses a
sqldatasource connecting to a sql server 2005 database with a select
statement simliar to this one:

SELECT warning_threshold, critical_threshold, weight FROM thresholds
UPDATE thresholds SET warning_threshold=@warning_threshold,
critical_threshold=@critical_threshold, weight =@weight
I also added insert and delete statements to this datasource.

The fields warning_threshold, critical_threshold and weight are of sql-type
real and contain figures between 0.00 and 1.00 (e.g 0.85).

In the gridview those figures are shown with commata (0,85) and if I try to
update the dataset I get thist error:

"Error converting data type nvarchar to real!"

How I can ensure that all real-numbers are shown with a decimal point
instead of a comma?
And how can I asure that the user can enter only decimal points too?

Thank you very much for any advice!

Yours,
Mathias
Sep 9 '06 #1
2 2999
Mathias,

Formatting is controlled by the cultural settings. If you've set an explicit
UI culture, or indicated an auto culture, or the server's inherient culture
uses a "european" numeric formatting (eg. 999 999,99) then what you are
seeing is the expected behavior.

You could force the culture in the web.config file:
<configuration>
<system.web>
<globalization
requestencoding="utf-8"
responseencoding=" utf-8"
fileencoding=" utf-8"
culture="de-DE"
uiculture="en" />
</system.web>
</configuration>
On a per page basis you can specify the culture:

<%@ Page Culture="ja-JP" UICulture="ja" ResponseEncoding="utf-8"%>

And you can do it with code:

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
You can also fish out the name of the current culture:

Thread.CurrentThread.CurrentCulture.EnglishName
Does any of that help?

Regards,

Rob MacFadyen
"Curious Trigger" <Cu*************@nospam.gmx.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hello,

if have an asp.net web page with a detailsview. This detailsview uses a
sqldatasource connecting to a sql server 2005 database with a select
statement simliar to this one:

SELECT warning_threshold, critical_threshold, weight FROM thresholds
UPDATE thresholds SET warning_threshold=@warning_threshold,
critical_threshold=@critical_threshold, weight =@weight
I also added insert and delete statements to this datasource.

The fields warning_threshold, critical_threshold and weight are of
sql-type real and contain figures between 0.00 and 1.00 (e.g 0.85).

In the gridview those figures are shown with commata (0,85) and if I try
to update the dataset I get thist error:

"Error converting data type nvarchar to real!"

How I can ensure that all real-numbers are shown with a decimal point
instead of a comma?
And how can I asure that the user can enter only decimal points too?

Thank you very much for any advice!

Yours,
Mathias

Sep 9 '06 #2
Hi Rob,

thank you very much! I changed my web.config and that solved my problem.
I couldn't simply cut and paste your text, because in web.config you have to
pay attention to lower-case and upper-case letters and leading spaces (e.g.
"utf-8" instead of " utf-8").
So I adopted it like this:

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
fileEncoding="utf-8"
culture="en-US"
uiCulture="en" />

Regards,
Mathias

"Rob MacFadyen" <rmacfadyen_at_gmail.comschrieb im Newsbeitrag
news:Oc**************@TK2MSFTNGP04.phx.gbl...
Mathias,

Formatting is controlled by the cultural settings. If you've set an
explicit UI culture, or indicated an auto culture, or the server's
inherient culture uses a "european" numeric formatting (eg. 999 999,99)
then what you are seeing is the expected behavior.

You could force the culture in the web.config file:
<configuration>
<system.web>
<globalization
requestencoding="utf-8"
responseencoding=" utf-8"
fileencoding=" utf-8"
culture="de-DE"
uiculture="en" />
</system.web>
</configuration>
On a per page basis you can specify the culture:

<%@ Page Culture="ja-JP" UICulture="ja" ResponseEncoding="utf-8"%>

And you can do it with code:

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
You can also fish out the name of the current culture:

Thread.CurrentThread.CurrentCulture.EnglishName
Does any of that help?

Regards,

Rob MacFadyen
"Curious Trigger" <Cu*************@nospam.gmx.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>Hello,

if have an asp.net web page with a detailsview. This detailsview uses a
sqldatasource connecting to a sql server 2005 database with a select
statement simliar to this one:

SELECT warning_threshold, critical_threshold, weight FROM thresholds
UPDATE thresholds SET warning_threshold=@warning_threshold,
critical_threshold=@critical_threshold, weight =@weight
I also added insert and delete statements to this datasource.

The fields warning_threshold, critical_threshold and weight are of
sql-type real and contain figures between 0.00 and 1.00 (e.g 0.85).

In the gridview those figures are shown with commata (0,85) and if I try
to update the dataset I get thist error:

"Error converting data type nvarchar to real!"

How I can ensure that all real-numbers are shown with a decimal point
instead of a comma?
And how can I asure that the user can enter only decimal points too?

Thank you very much for any advice!

Yours,
Mathias


Sep 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9371
by: arijitchatterjee123 | last post by:
Hi Group, I am new with SQL Server..I am working with SQL Server 2000. I am storing the date in a nvarchar column of atable.... Now I want to show the data of Weekends..Everything is OK...But the...
0
2117
by: Roman | last post by:
I'm trying to create the form which would allow data entry to the Client table, as well as modification and deletion of existing data rows. For some reason the DataGrid part of functionality stops...
12
8669
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
1
4415
by: Andrew Baker | last post by:
this seems to be an SQL Server error but I cant work out how it is occuring. Itr is also after 3am and I cant keep working but need to demo by tomorrow. TIA. The code is: Private Sub...
4
4459
by: P. Yanzick | last post by:
Hello, I've been playing with master/detail views as well as editing in the gridview, and I ran across a strange problem that I am not exactly sure where to go to try to solve. I have 2...
0
1626
by: tom c | last post by:
I am going through "Walkthrough: Editing and Inserting Data in Web Pages with the DetailsView Web Server Control" found at http://msdn2.microsoft.com/en-us/library/sdba1d59.aspx I am using...
0
2767
by: Adele | last post by:
Please help, I'm new to SQL and I use a script to import data and when I tried importing data tonight it gave me "error converting data type nvarchar to float". I have no idea what this error...
2
5482
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
1
1185
by: cmrhema | last post by:
Hi, I want to retrieve the values from store_geofence table where the timeduration exceeds certain interval the procedure is as below CREATE procedure . @regno nvarchar(50), @frmdate...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.