Home All Groups Group Topic Archive Search About

DBTYPE_DBTIMESTAMP OLE DB question

Author
22 Dec 2005 5:42 PM
dermite
Folks,

I am trying to use ole db to read a date field created as a DATETIME in C#.
It only seems to work if I set the binding type (wType) to
DBTYPE_DBTIMESTAMP. When I do this, 16 bytes of data are written to my
buffer. The question then is what to do with this raw data. What should I
cast it to, so that I can make use of it? I can't think of date/time types
that are 16 bytes long.

Thank you,

Matthew Fleming

Author
22 Dec 2005 9:17 PM
Mike Epprecht (SQL MVP)
Hi

The SQL Server data type "Timestamp" has nothing to do with date or time. It
is a binary number that is sequential and is generally used for concurrency
control in applications.

Regards
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: m***@epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

Show quote
"dermite" <derm***@discussions.microsoft.com> wrote in message
news:614ADA8C-E424-4419-9FBC-B86C93646E80@microsoft.com...
> Folks,
>
> I am trying to use ole db to read a date field created as a DATETIME in
> C#.
> It only seems to work if I set the binding type (wType) to
> DBTYPE_DBTIMESTAMP. When I do this, 16 bytes of data are written to my
> buffer. The question then is what to do with this raw data. What should I
> cast it to, so that I can make use of it? I can't think of date/time types
> that are 16 bytes long.
>
> Thank you,
>
> Matthew Fleming
Author
22 Dec 2005 9:27 PM
dermite
If this is so, then why is the field (which was created as type DATETIME),
readable only with a binding type of  DBTYPE_DBTIMESTAMP?  I tried
DBTYPE_DATE and it did not work (0 bytes were written to the buffer).

Matthew Fleming

Show quote
"Mike Epprecht (SQL MVP)" wrote:

> Hi
>
> The SQL Server data type "Timestamp" has nothing to do with date or time. It
> is a binary number that is sequential and is generally used for concurrency
> control in applications.
>
> Regards
> --------------------------------
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
>
> IM: m***@epprecht.net
>
> MVP Program: http://www.microsoft.com/mvp
>
> Blog: http://www.msmvps.com/epprecht/
>
> "dermite" <derm***@discussions.microsoft.com> wrote in message
> news:614ADA8C-E424-4419-9FBC-B86C93646E80@microsoft.com...
> > Folks,
> >
> > I am trying to use ole db to read a date field created as a DATETIME in
> > C#.
> > It only seems to work if I set the binding type (wType) to
> > DBTYPE_DBTIMESTAMP. When I do this, 16 bytes of data are written to my
> > buffer. The question then is what to do with this raw data. What should I
> > cast it to, so that I can make use of it? I can't think of date/time types
> > that are 16 bytes long.
> >
> > Thank you,
> >
> > Matthew Fleming
>
>
>
Author
22 Dec 2005 10:59 PM
Erland Sommarskog
Mike Epprecht (SQL MVP) (m***@epprecht.net) writes:
> The SQL Server data type "Timestamp" has nothing to do with date or
> time. It is a binary number that is sequential and is generally used for
> concurrency control in applications.

Yes, but the OLE DB data type DBTYPE_DBTIMESTAMP has everything to do
with date and time. That is in fact how you get back the datetime data type
from SQL Server.

Anyway, the actual question have been sorted out in
microsoft.public.olddb.data. Please to do not post the same question to
different newsgroups independently!


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button