473,608 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DateT ime. 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 1209
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.Te xt)

"Jon" <co****@columbu sinteractive.co m> 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.DateT ime. 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****@columbu sinteractive.co m> 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.DateT ime. 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
2469
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 is not making it work. If I enter date like 25/12/1976 then it works fine as the date will not be valid like 12/25/1976 and everything works fine and my query executes properly.
8
1595
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 properly. if I decided to select 2 dates: the starting date(August for istance) and the finishing date of the next month(September), what happens is the finishing date swaps the month with the day . For Example if I chose to have the report from the...
0
1467
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 myself but now I want to move to textpattern (http://www.textpattern.com/). Using a mySQL tool called NaviCat, I can easily create queries regarding porting ID, text data etc. from my old DB into the textpattern DB (using INNER JOINS it seems). But...
4
2421
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 ("2004-11-29") but it's wrong in Internet Explorer 6SP1 ("00:20:15-11-29"). If I change "dateParts" to "dateParts", it's exactly the opposite that occures: a correct result in IExplorer but a fault in Firefox. Is there a workaround? Where do I miss the...
2
3958
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 current date. The last time I tried this the database got very upset and the date functions such as DAYOFWEEK_ISO, YEAR, WEEK, QUARTER etc got all screwed up and failed. I subsequently had to completely drop the database, recreate from scratch and...
9
3412
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 period and 13 periods a year. normally 52 weeks per year but one 53-week a year every 6 years. The 53th week is included in period 13. Can someone advise any idea how to construct such conversion.
3
2182
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 .NET, I would like to get only those that are supported for my application.
3
1964
by: Karunakararao | last post by:
Hi All DateTime populaing based on regional settings In ASP.NET Application Iam using this Code: Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(HttpContext.Current.Request.UserLanguages); Thread.CurrentThread.CurrentUICulture = new CultureInfo(HttpContext.Current.Request.UserLanguages);
0
6729
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, SPECTRAMIND SOLUTIONS now announces a new batch of Prep Courses for CSQA & CSTE& ISEB & ISTQB & Business Analyst & SOA so as to prepare you thoroughly for the most prestigious certification exams conducted by International organizations. We...
0
8069
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8011
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8488
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8160
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8358
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6826
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5482
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4036
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2479
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 we have to send another system

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.