473,388 Members | 1,468 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,388 software developers and data experts.

Cultures & dates

Jon
I have an asp.net app that I've localized using satellite assemblies. It
works wonderfully, even for displaying dates. My problem comes when I try
to use one of those dates in a SQL query.

I have an SQL like "SELECT * FROM Table WHERE date < @Date"
I make a parameter for it as type SQLDBType.DateTime. This works great for
US dates (12/31/04, for instance). But, the equivalent Frnech date
(31/12/04) throws an excption with the following error: "String was not
recognized as a valid DateTime."
So, I need to know how to convert the french date back to US format so the
SQL server doesn't puke. I'm sure there's a simple way to accomplish this,
but so far it's eluding me.
Nov 19 '05 #1
2 1197
Jon
I had been using it all along, but for something different...
set the thread culture and execute the following and it will put it back to
US format....
Dim a As Date = DateTime.Parse(Me.txtDateTo.Text)

"Jon" <co****@columbusinteractive.com> wrote in message
news:1j******************@fe2.columbus.rr.com...
I have an asp.net app that I've localized using satellite assemblies. It
works wonderfully, even for displaying dates. My problem comes when I try
to use one of those dates in a SQL query.

I have an SQL like "SELECT * FROM Table WHERE date < @Date"
I make a parameter for it as type SQLDBType.DateTime. This works great
for US dates (12/31/04, for instance). But, the equivalent Frnech date
(31/12/04) throws an excption with the following error: "String was not
recognized as a valid DateTime."
So, I need to know how to convert the french date back to US format so the
SQL server doesn't puke. I'm sure there's a simple way to accomplish
this, but so far it's eluding me.

Nov 19 '05 #2
Hmm, cultured Dates. I'd steer clear. They might be "bad" dates. Remember
"Raiders of the Lost Ark?' Hmmm?

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Jon" <co****@columbusinteractive.com> wrote in message
news:1j******************@fe2.columbus.rr.com...
I have an asp.net app that I've localized using satellite assemblies. It
works wonderfully, even for displaying dates. My problem comes when I try
to use one of those dates in a SQL query.

I have an SQL like "SELECT * FROM Table WHERE date < @Date"
I make a parameter for it as type SQLDBType.DateTime. This works great
for US dates (12/31/04, for instance). But, the equivalent Frnech date
(31/12/04) throws an excption with the following error: "String was not
recognized as a valid DateTime."
So, I need to know how to convert the french date back to US format so the
SQL server doesn't puke. I'm sure there's a simple way to accomplish
this, but so far it's eluding me.

Nov 19 '05 #3

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

Similar topics

4
by: J P Singh | last post by:
Hi All I am trying to query a database with a combination of surname and date of birth but it is giving me wrong results in certain conditions. It is the mm/dd/yyyy and dd/mm/yyyy stuff that...
8
by: tom | last post by:
hello lads - got a problem; I made a file that should write down a report into the excel cells. the issue is not coming from the sql or summat, but from excel file cannot convert the date...
0
by: Massimo Fiorentino | last post by:
Hello there! I am a bit of a newbee into the mySQL world and I have a question regarding switching from one DB to another. I have for a couple of years used a very simple CMS-system created by...
4
by: kinne | last post by:
The following code is supposed to reverse the date in "yyyy-mm-dd" format, but it produces different results in Firefox 1.0 and in Internet Explorer 6SP1. In Firefox, the result is correct...
2
by: p175 | last post by:
People, I have an ESE 8.2.2 database running on win2k server . I need to do some system testing that requires I reset the dates back a couple of years then progressivily move it forward to...
9
by: Ray | last post by:
I need to convert the normal calendar to show the week no., the period no. and the financial year. The financial year format is as follows:- Date start: 2 May, 2005 7 days a week, 4 weeks a...
3
by: znappa | last post by:
Hi. Is there a way to get a list of supported cultures/languages for my application. By calling CultureInfo.GetCultures( CultureTypes.AllCultures )) I get the whole list of supported cultures en...
3
by: Karunakararao | last post by:
Hi All DateTime populaing based on regional settings In ASP.NET Application Iam using this Code: Thread.CurrentThread.CurrentCulture =...
0
by: Vijay | last post by:
Prep Courses for International Certifications, CSTE & CSQA & ISEB & ISTQB &Business Analyst & SOA Certifications in HYDERABAD. After receiving overwhelming response to our last 50+ batches, ...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?
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
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
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,...

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.