FAQs about Other OLEDB Objects

  1. Since Microsoft released MDAC 2.6, they have integrated a way to access and retrieve data as XML. This features is very important to me. Does OLEDBPro offer this functionality?
            Yes! See the class COStream overview. Microsoft support sites has a couple of examples to retrieve XML from SQL Server 2000 using ADO and ATL consumer templates. You can easily convert all of these samples with OLEDBPro.
  2. Is SQL-Server 2000 supported ?
            Yes! You can easily use OleDBPro with SQL-Server 2000. For how to use standard SQL/Transact-SQL, see the example MultiRecords. For how to use SQL Server OLAP service, see the example OLAP. For how to use XML, see the class COStream overview.

  3. Does OleDBPro support SQL Server 2k specific data type, DBTYPE_SQLVARIANT?
            Beginning from the version 1.5.0.0 of OleDBPro, OleDBPro internally supports DBTYPE_SQLVARIANT. However, you must turn on the property SSPROP_ALLOWNATIVEVARIANT of property set of DBPROPSET_SQLSERVERSESSION if a sql_variant data type is fetched as SSVARIANT. See the following code.

    #include <sqloledb.h>
    #include <oledb25.h>

    ..............

    class COSessionProp : public COSession
    {
    public:
    bool SetProperties(ULONG cPropertySets, DBPROPSET rgPropertySets[])
    {
    ATLASSERT(IsOpen());
    CComPtr<ISessionProperties> pISessionProperties;
    m_hr=(*GetBaseInterfacePPtr())->QueryInterface(__uuidof(ISessionProperties), (void**)&pISessionProperties);
    if(FAILED(m_hr))
    {
    if(m_pGetErrorInfo) 
    m_pGetErrorInfo(*GetBaseInterfacePPtr(), GetBaseIID(), &m_strError);
    return false;
    }
    m_hr=pISessionProperties->SetProperties(cPropertySets, rgPropertySets);
    if(FAILED(m_hr))
    {
    if(m_pGetErrorInfo) 
    m_pGetErrorInfo(pISessionProperties, __uuidof(ISessionProperties), &m_strError);
    return false;
    }
    return true;
    }
    };

    COPropSet SessionPropSet(DBPROPSET_SQLSERVERSESSION);
    if(!ODataSource.Open())
    {
    wcout<<"Error information: "<<ODataSource.m_strError<<endl;
    return;

    if(!OSession.Open(ODataSource.m_pIDBInitialize))
    {
    wcout<<"Error information: "<<OSession.m_strError<<endl;
    return;

    SessionPropSet.AddProperty(SSPROP_ALLOWNATIVEVARIANT, true);
    OSession.SetProperties(1, &SessionPropSet);
    OpenWithCmnd(OSession.m_pIOpenRowset, BulkRecord, strStatement);