PC Review


Reply
Thread Tools Rate Thread

Date format in SQLServer CE

 
 
Peter Royle
Guest
Posts: n/a
 
      10th Nov 2003
Canyone tell me how I can get SQLServerCE to recognise the dates I am
passing to it from VB.NET? I get the date using now() and pass it into
a query on my PocketPC, which has its locale set to English (UK) -
DD/MM/YYYY, but it will only accept dates that can be interpreted as
US - style: MM/DD/YYYY. So Nov 12th is OK, but Nov 13th causes an
error.

Using System.Globalization.CultureInfo doesn't seem to help.

Do I have to convert it to a string, and abandon any attempt to use a
date field? This is possible, but an unbelievable pain.

How do we convince Microsoft that there are other countries than the
US out there??

Peter Royle
 
Reply With Quote
 
 
 
 
Jonathan Wells [msft]
Guest
Posts: n/a
 
      10th Nov 2003
Hi Peter,

The problem is with SQL Server CE's locale setting. Here's an excerpt from
the SSCE Books Online:
-------------------------
All databases created without specifying a locale
identifier (LCID) are assigned the default locale
identifier, 1033 (0x00000409) for U.S. English. To create
a database with a locale identifier different from the
default, specify the locale identifier. For example:

cat.Create "Provider=Microsoft.SQLSERVER.OLEDB.CE.1.0;
data source=\test2.sdf;Locale Identifier=1041"
-------------------------
Changing the LCID to your specified locale may solve your problem.

For more info check out the SQL Server CE books online:
http://msdn.microsoft.com/library/en...al_support.asp

cheers jonathan
--
Jonathan Wells
Product Manager
..NET Compact Framework
Check out the .NET Compact Framework FAQ at:
http://msdn.microsoft.com/mobility/p...Q/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.

"Peter Royle" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Canyone tell me how I can get SQLServerCE to recognise the dates I am
> passing to it from VB.NET? I get the date using now() and pass it into
> a query on my PocketPC, which has its locale set to English (UK) -
> DD/MM/YYYY, but it will only accept dates that can be interpreted as
> US - style: MM/DD/YYYY. So Nov 12th is OK, but Nov 13th causes an
> error.
>
> Using System.Globalization.CultureInfo doesn't seem to help.
>
> Do I have to convert it to a string, and abandon any attempt to use a
> date field? This is possible, but an unbelievable pain.
>
> How do we convince Microsoft that there are other countries than the
> US out there??
>
> Peter Royle



 
Reply With Quote
 
Peter Royle
Guest
Posts: n/a
 
      11th Nov 2003
Jonathan,

thanks for this - but what is the correct LCID for UK English? On SQL
CE Books Online, I can find a list of them, but it doesn't say which
is which - and "0x00000409" doesn't seem to be one of them, so I have
no way of tying up the list of LCIDs with the list of locales that's
next to it (the numbers are different, anyway). It does appear in the
column marked "Unique LCIDs" - but according to this list, UK and US
English are in the same "Identical LCID group" - so how do I
distinguish between them?

Peter Royle

"Jonathan Wells [msft]" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Hi Peter,
>
> The problem is with SQL Server CE's locale setting. Here's an excerpt from
> the SSCE Books Online:
> -------------------------
> All databases created without specifying a locale
> identifier (LCID) are assigned the default locale
> identifier, 1033 (0x00000409) for U.S. English. To create
> a database with a locale identifier different from the
> default, specify the locale identifier. For example:
>
> cat.Create "Provider=Microsoft.SQLSERVER.OLEDB.CE.1.0;
> data source=\test2.sdf;Locale Identifier=1041"
> -------------------------
> Changing the LCID to your specified locale may solve your problem.
>
> For more info check out the SQL Server CE books online:
> http://msdn.microsoft.com/library/en...al_support.asp
>
> cheers jonathan
> --
> Jonathan Wells
> Product Manager
> .NET Compact Framework
> Check out the .NET Compact Framework FAQ at:
> http://msdn.microsoft.com/mobility/p...Q/default.aspx
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Peter Royle" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Canyone tell me how I can get SQLServerCE to recognise the dates I am
> > passing to it from VB.NET? I get the date using now() and pass it into
> > a query on my PocketPC, which has its locale set to English (UK) -
> > DD/MM/YYYY, but it will only accept dates that can be interpreted as
> > US - style: MM/DD/YYYY. So Nov 12th is OK, but Nov 13th causes an
> > error.
> >
> > Using System.Globalization.CultureInfo doesn't seem to help.
> >
> > Do I have to convert it to a string, and abandon any attempt to use a
> > date field? This is possible, but an unbelievable pain.
> >
> > How do we convince Microsoft that there are other countries than the
> > US out there??
> >
> > Peter Royle

 
Reply With Quote
 
Mark Johnson
Guest
Posts: n/a
 
      11th Nov 2003
try :
if (dset_Table.Columns[i].DataType == typeof(System.DateTime)) //
DateTime needed in SqlCe as
s_DataType = Convert.ToDateTime(dset_Row[i]).ToString("s"); //
2003-09-26T00:00:00
This works on a German Mashine and english emulation.
Mark Johnson, Berlin Germany
(E-Mail Removed)

"Jonathan Wells [msft]" <(E-Mail Removed)> schrieb im
Newsbeitrag news:(E-Mail Removed)...
> Hi Peter,
>
> The problem is with SQL Server CE's locale setting. Here's an excerpt from
> the SSCE Books Online:
> -------------------------
> All databases created without specifying a locale
> identifier (LCID) are assigned the default locale
> identifier, 1033 (0x00000409) for U.S. English. To create
> a database with a locale identifier different from the
> default, specify the locale identifier. For example:
>
> cat.Create "Provider=Microsoft.SQLSERVER.OLEDB.CE.1.0;
> data source=\test2.sdf;Locale Identifier=1041"
> -------------------------
> Changing the LCID to your specified locale may solve your problem.
>
> For more info check out the SQL Server CE books online:
>

http://msdn.microsoft.com/library/en...al_support.asp
>
> cheers jonathan
> --
> Jonathan Wells
> Product Manager
> .NET Compact Framework
> Check out the .NET Compact Framework FAQ at:
>

http://msdn.microsoft.com/mobility/p...Q/default.aspx
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>
> "Peter Royle" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Canyone tell me how I can get SQLServerCE to recognise the dates I am
> > passing to it from VB.NET? I get the date using now() and pass it into
> > a query on my PocketPC, which has its locale set to English (UK) -
> > DD/MM/YYYY, but it will only accept dates that can be interpreted as
> > US - style: MM/DD/YYYY. So Nov 12th is OK, but Nov 13th causes an
> > error.
> >
> > Using System.Globalization.CultureInfo doesn't seem to help.
> >
> > Do I have to convert it to a string, and abandon any attempt to use a
> > date field? This is possible, but an unbelievable pain.
> >
> > How do we convince Microsoft that there are other countries than the
> > US out there??
> >
> > Peter Royle

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
export from sqlserver in html format with .xls extension and enabling DisplayGridlines scirocco1@gmail.com Microsoft Excel Misc 0 24th Jan 2007 08:35 AM
Formating Date/Time in an Access FrontEnd with a SQLServer backend David C. Holley Microsoft Access VBA Modules 2 14th Apr 2006 03:16 PM
How to put a Date into SQLServer (.NET) Des Microsoft Dot NET 2 24th Feb 2006 07:56 PM
sqlserver ce Valid Date Converted to Null jadidk@gmail.com Microsoft Dot NET Compact Framework 3 14th Dec 2005 11:28 PM
(re)format output (data type) from SQLServer to DataGrid D. Shane Fowlkes Microsoft ASP .NET 2 18th Feb 2004 08:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:16 PM.