By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

Cultures & dates

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.