SQL timestamp data type - correspondency with c++ data type

SQL timestamp data type - correspondency with c++ data type

Post by Carlos Miguel Rodrigue » Tue, 04 Jun 2002 15:29:37



Hi there.

I'm accessing an MS SQL database with tables where I have
a timestamp column.
What C++ type should I give the variable witch will get
that column's value?
How do I retrieve it using CRecordset::GetFieldValue()
method?

Code will be apreciated. Thank you.

Miguel.

 
 
 

SQL timestamp data type - correspondency with c++ data type

Post by Duke S » Thu, 06 Jun 2002 12:59:04


The timestamp type is correspoding to the binary array. CLongBinary or
CByteArray.

Please refer to the following code snippet:

        CDBVariant dbv;
        m_pSet->GetFieldValue( short(0), dbv, DEFAULT_FIELD_TYPE );
        CLongBinary *lb = dbv.m_pbinary;
        BYTE * pData = (BYTE *)GlobalLock(lb->m_hData);
        CString strData;
        strData.Format("%02X%02X%02X%02X%02X%02X%02X%02X", *pData,
*(pData+1),*(pData+2),*(pData+3),*(pData+4),*(pData+5),*(pData+6),*(pData+7)
);

 
 
 

1. Mapping ADO data types with C++ data types

I am trying to create tables in an Access database using ADO / C++. I need
fields with type Date, Time, and Boolean. What would be the appropriate SQL
statement for it? Also, what corresponding C++ data type should I use to
hold the data from these fields?

I also need to store a 6 byte number in the database. Should I store it as
an array of chars?  Are the chars stored as unsigned chars?

Would I have to make any change in my code if I were to migrate to another
database?

Thanks in advance.
Sabyasachi Basu

2. How to get multiple rows from stored procedure?

3. US-NY-IT BUSINESS ANALYST

4. Data Transfer from Long data type to SQL Server Text data type column

5. ADO and SQLSERVER: What's WRONG with this function???

6. sql data type vs vb data type

7. startup error: ORA-01534: rollback segment 'R01' doesn't exist

8. Mapping SQL Server Data Types and ADO Data Type Enums

9. conversion of ODBC SQL data types to ODBC C data types

10. Data Type SQL Server7.0 need a non decimal 1 E 19 data type

11. Mapping ADO Data Types to SQL Server Data Types

12. Does VB a similar data type like the C++ Union type