Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to specify dateformat for ADO Connection?

177 views
Skip to first unread message

jimmers

unread,
Mar 24, 2005, 3:57:01 AM3/24/05
to
Good day

In my application ADO Connection’s Open() method is used to open connection
to SQL Server. Using profiler I see the following for Audit Login event:

-- network protocol: TCP/IP
set quoted_identifier on
set implicit_transactions off
set cursor_close_on_commit off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set language us_english
set dateformat mdy
set datefirst 7

I figured out that some of the above settings can be changed
programmatically via Properties collection of the Connection object. For
example, it is possible to specify language using “Current Language” property
if Provider is SQLOLEDB.

My question is about changing dateformat setting: how to do this?

Please do not offer to issue “SET DATEFORMAT …” command. I need to influence
it in the above packet. Changing default login language also is not an option
because I need to set only date strings input format and do not change
anything else.

With best regards
Martin Rakhmanov
http://jimmers.russia.webmatrixhosting.net/

Mike Epprecht (SQL MVP)

unread,
Mar 24, 2005, 4:23:03 AM3/24/05
to
Hi

Date formatting is a client side issue. The application code needs to do it.
The other option is the convert it to a string at select time, using the
appropriate time format (see convert in BOL).

SQL Server is a database, not a presentation tier.

Regards
Mike

jimmers

unread,
Mar 24, 2005, 4:27:04 AM3/24/05
to
Sorry but my question is about affecting dateformat at the login time not
about formatting issues.

Alejandro Mesa

unread,
Mar 24, 2005, 10:27:05 AM3/24/05
to
Why do you want to do that?, if you use ISO or ISO8601 (see CONVERT function
in BOL, styles 112 and 126) formatS, then sql server will interpret the
values independently of the settings of the LANGUAGE and DATEFORMAT in use.


AMB

"jimmers" wrote:

> Here is more information: dateformat shown in the Audit Login record comes
> from login default language. Seems that it is not possible to set this using
> ADO Connection object properties for SQLOLEDB provider.

jimmers

unread,
Mar 24, 2005, 11:17:03 AM3/24/05
to
Well, I have third-party application that I cannot affect at all.
0 new messages