473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

regional settings, .Net & DB

doing some research on regional settings, .Net & DB
I put my machine in Germany(Germany)
thus the decimal char = ","
the seperator char = "."
so I set up the database for a test in .Net
I'm using Access.
a field (double) contains 45,56

I read the record using DataReader

then I did a read:

mVariable = .GetDouble(TheOrdinalPos)
mVariable shows "45.56" which means the comma got translate to the period.
on the Update, myActionQuery is.......
myActionQuery = "UPDATE Table1 SET Fld1 = " & mVariable & " Where Id = " & Id
....................
myCommand.CommandText = myActionQuery
myActionQuery shows
"UPDATE Table1 SET Fld1 = 45,56 Where Id = 10"

notice the 45.56 was turned into 45,56 (that's with a comma for the
decimal character)

but on the actual execute command,
numOfRecordsUpdated = myCommand.ExecuteNonQuery()
it caused a trap.... invalid statement

but when I changed from Germany to English and reran the code, with no code
changes, same scenario
the UPDATE worked...

I am obviously missing something dealing with Regional setting... can some
one fill me in?
Jul 21 '05 #1
3 1570
JohnK,

I cannot see what is mVariable, I assume a string.

"UPDATE Table1 SET Fld1 = " & mVariable & " Where Id = " & Id

Why you think that the comma should be in the German language while the rest
is all (US) English.

It is just an SQL command from which we can often read that it is in a for
everybody normal way written, and therefore for everybody easy to understand
(and than forget that only less than 8% of the world populations can write
English).

However, for this are the oledbparameters

http://msdn.microsoft.com/library/de...eterstopic.asp

I hope this helps?

Cor
Jul 21 '05 #2
my machine is set to Germany(Germany)

mVariable is of type double

when I build the query string,
"UPDATE Table1 SET Fld1 = " & mVariable & " Where Id = " & Id
the resulting query string ends up being:
"UPDATE Table1 SET Fld1 = 45,56 Where Id = 10"
the string is obviously build using cultural settings....

obviously either ADO or Access does not like that query string as it traps.

but if I put my machine in English regional settings
"UPDATE Table1 SET Fld1 = " & mVariable & " Where Id = " & Id
the resulting query string ends up being:
"UPDATE Table1 SET Fld1 = 45.56 Where Id = 10"
works fine.

Since I have no control over the end user's machine's regional settings
I need to be able to build the query string such that ADO/Access does not
complain about it....
Jul 21 '05 #3
John,

I know, however I showed you the proper method to use those parameters..

UPDATE Table1 SET Fld1 =? Where Id =?"

And than create the parameter collection in the right sequense.

http://msdn.microsoft.com/library/de...eterstopic.asp

Why don't you use that proper method?

Cor
Jul 21 '05 #4

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

Similar topics

4
by: Grumfish | last post by:
Is there a way to tell Java what localization to use so applications and the compiler doesn't default to the system's setting? I'm using a computer with Windows 2000 with a regional setting of...
1
by: nerman | last post by:
Hello I have a problem with the regional settings. I have set the regional settings of the web server to display the numbers in this format 123.456,78 But when I open my web site all number are...
4
by: Jonathan | last post by:
Dear All, I am trying to set a webserver to use French regional settings for testing ASP pages. According to http://support.microsoft.com/kb/q306044, for IIS5, this is a matter of changing...
2
by: Bob Dydd | last post by:
Hi Everbody Question Changing the regional settings ie. from UK to US AUS etc, Access retains the original currency format that the application was created in. So if an mdb that is written...
1
by: John | last post by:
Hi, The following behavior when using J# vs. C# is really bothering me. When I have the regional settings on my workstation set to a non-US settings (eg: Danish); it seems that J# disregards...
1
by: Lachlan James | last post by:
Hi, I have an asp.net web form that uses a rangevalidation control to validate a date field. My regional settings are set to Australia and it works fine on my system (winXP). However on...
12
by: magister | last post by:
Hello, I know I can set the Culture to what I want, but shouldn't the current culture be taken from the regional settings on the web server's control panel!!! Mine is set to "united kingdom"...
3
by: JohnK | last post by:
doing some research on regional settings, .Net & DB I put my machine in Germany(Germany) thus the decimal char = "," the seperator char = "." so I set up the database for a test in .Net I'm...
16
by: Colmag | last post by:
I've written an application with vb.net 2003 (framework 1.1) which automates a 3rd party viewing/printing application (via an activex control). I've released several versions over the last year...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.