473,396 Members | 2,081 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.

fast replay : regional setting

i am writing following code to insert value in table test which has two fields
id , current_ date but if i change
regional seting English(United Staes ) to french(France) then it hows error

it show error if regionl setting is English(United Staes ) value inserted sucessfully
any one tell how i set regional setting for my project
Expand|Select|Wrap|Line Numbers
  1.  
  2.     try
  3.             {
  4.                     ss = DateTime.Now;
  5.                 objSqlConnection.Open();
  6.                 SqlCommand objSqlCommand = new  SqlCommand ("insert into test values ( '" + ss + "',125)",objSqlConnection);
  7.                 objSqlCommand.ExecuteNonQuery();
  8.                 MessageBox.Show("Inserted sucessfully");
  9.                 objSqlConnection.Close();
  10.             }
  11.             catch(Exception ex)
  12.             {
  13.                 MessageBox.Show(ex.Message);
  14.                 objSqlConnection.Close();
  15.             }
Nov 16 '07 #1
5 1293
kunal pawar
297 100+
Can u tell Error ??
It may be the problem of column name. Whn u changed the Regional setting it will change Column name too, which are not same as SQL Server Table column name
Nov 16 '07 #2
hi
error is conversion char datatype to datatype datetime
&& current date in following forat 01/01/0001 00:00:00
Nov 16 '07 #3
mzmishra
390 Expert 256MB
You have to specify the proper Date format while inserting the data.
Nov 16 '07 #4
CyberSoftHari
487 Expert 256MB
You have to insert the date format as

Expand|Select|Wrap|Line Numbers
  1. string.Format("{0:MM/dd/yyyy}",DateTime.Now);
  2.  
  3. //or
  4. string.Format("{0:yyyy/MM/dd}",DateTime.Now);
Otherwise it will consider as string.
Nov 16 '07 #5
Frinavale
9,735 Expert Mod 8TB
You should check your Resources that handle your Cultural Regions so that it formats dates as well as other data types (like numbers) correctly.
Nov 16 '07 #6

Sign in to post your reply or Sign up for a free account.

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...
6
by: Niyazi | last post by:
Hi, We have and IBM AS400 and I belive the reional setting is Turkish. The IBM Client-Access for Windows that install in our PC (WIN XP SP2) set to Turkish characters. Now my PC has English...
1
by: Karl Irvin | last post by:
My regional setting is English(United States) My customers setting is French(Canada) When he runs my program using a typed in date, he gets a "date invalid" error. Do I need to do something...
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"...
7
by: Fred Flintstone | last post by:
I'm writing a VB.Net windows forms application. This line of code: Personal.EffectiveDate = GridRow2.Cells("New Value").Value.ToString.Trim Fails with this error: Cast from string...
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...
4
by: Harold Crump | last post by:
Greetings, This is not strictly a ASP.NET question, but I am hoping someone can help. I have an ASP.NET web app that used the DateTime.Parse and Compare methods a lot. As expected, the...
0
by: bvdb | last post by:
Hi Everyone, One of my customers lives in Taiwan and can only make my program work if he changes his Regional and Language Options to English from the Simplifies Chinese that his computer is...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.