ATL OLEDB Consumer Templates, SQL CE
- From: "vvf" <novvfspam@xxxxxxxxxxx>
- Date: Mon, 19 Jun 2006 21:11:01 -0400
Hi All,
I wrote a program to access some data from a SQL Server CE database (the
program is running on the Windows CE device.) I am able to use the ATL OLEDB
Consumer Templates (thanks to Joao Figueira) but I am unable to read a
"datetime" field.
I am using a CDynamicAccessor and am using the "GetValue" member function. I
know that I have to cast the return value to the correct type in order to
use the returned data. For example, I am receiving a string by doing:
CString str = (LPCTSTR)cmd.GetValue(1); for getting a string from column 1
(cmd is a CCommand object.) However, I am not sure what kind of cast I have
to do to access a "datetime" field. I tried the same cast as for a regular
string but I was unable to obtain the data that I expected. As I was
unsuccessful doing that, I have tried to use the "TranslateColumnNo"
function in conjunction with _GetDataPtr as follows:
cmd.MoveFirst();
,,,
ULONG ulNo = 1;
cmd.TranslateColumnNo(ulNo);
CString str = (LPCTSTR) (cmd._GetDataPtr(ulNo)); but I still got an emptry
string; then I tried using this:
cmd.GetInternalColumnNo(_T("ColumnName"), &ulNo);
CString str = (LPCTSTR) (cmd._GetDataPtr( ulNo)); // but I got some
garbage...
So, what kind of cast or how should one proceed to get a datetime field into
a CString using CDynamicAccessor?
Thanks!
.
- Follow-Ups:
- Re: ATL OLEDB Consumer Templates, SQL CE
- From: João Paulo Figueira
- Re: ATL OLEDB Consumer Templates, SQL CE
- Prev by Date: Re: SqlCeResultSet: catching events
- Next by Date: Re: SqlCeResultSet: catching events
- Previous by thread: Encryption question
- Next by thread: Re: ATL OLEDB Consumer Templates, SQL CE
- Index(es):
Relevant Pages
|
Loading