Hi,

I'm bulding SQL Commands with
System.Threading.Thread.CurrentThread.CurrentCulture = cu

String.Format(MSSQLComand, Startdate.ToShortDateString,
EndDate.ToShortDateString)

When I'm running this against an English Database Server this works, how
ever this does not againt an Italian one.

What is best practice to fight this localization issue?

Thanks in advance for any advice
Andrew

--
Andrew Smith

Re: Building SQL Commands in .NET with DateTime that run against SQL Servers with different regional settings by Bob

Bob
Thu Feb 17 16:09:38 CST 2005

Use a standardized date format. For SQL Server 'YYYYMMDD'.

Bob Lehmann

"Andrew Smith" <nospam@hotmail.com> wrote in message
news:OIi5hJTFFHA.1296@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I'm bulding SQL Commands with
> System.Threading.Thread.CurrentThread.CurrentCulture = cu
>
> String.Format(MSSQLComand, Startdate.ToShortDateString,
> EndDate.ToShortDateString)
>
> When I'm running this against an English Database Server this works, how
> ever this does not againt an Italian one.
>
> What is best practice to fight this localization issue?
>
> Thanks in advance for any advice
> Andrew
>
> --
> Andrew Smith
>
>



Re: Building SQL Commands in .NET with DateTime that run against SQL Servers with different regional settings by Andrew

Andrew
Fri Feb 18 02:51:05 CST 2005

Hi Bob,

thanks for your answer. I found out that I can read this format from SQL
Server and read in .NET with:

select convert(datetime,'20040508',112)

Dim dt as DateTime = DateTime.ParseExact("20040508", "yyyyMMdd", Nothing)

http://www.dotnet247.com/247reference/msgs/44/220791.aspx

Do you know the easiest way how to bring a datetime value to the YYYYMMDD
String Format?

Thanks in advance for any advice

Andrew

--
Andrew Smith



Re: Building SQL Commands in .NET with DateTime that run against S by KerryMoorman

KerryMoorman
Fri Feb 18 11:39:04 CST 2005

Andrew,

One way is to use the Format function. For example:

Dim dt As DateTime = Now
Dim dtString As String

dtString = Format(dt, "yyyyMMdd")
MsgBox(dtString)

Kerry Moorman




"Andrew Smith" wrote:

> Hi Bob,
>
> thanks for your answer. I found out that I can read this format from SQL
> Server and read in .NET with:
>
> select convert(datetime,'20040508',112)
>
> Dim dt as DateTime = DateTime.ParseExact("20040508", "yyyyMMdd", Nothing)
>
> http://www.dotnet247.com/247reference/msgs/44/220791.aspx
>
> Do you know the easiest way how to bring a datetime value to the YYYYMMDD
> String Format?
>
> Thanks in advance for any advice
>
> Andrew
>
> --
> Andrew Smith
>
>
>

Re: Building SQL Commands in .NET with DateTime that run against S by Andrew

Andrew
Fri Feb 18 13:33:38 CST 2005

Thanks

--
Andrew Smith