ADO with C++? No way

ADO with C++? No way

Post by Arpad Tamas » Sat, 27 Jun 1998 04:00:00



I would like to open an ADO recordset in C++. The second parameter of
_RecordsetPtr.Open is _variant_t&. How can I convert a _ConnectionPtr to
_variant&?

Thanks for your help,
Arpad Tamasi

PS.

Code that doesn't work:
_ConnectionPtr Conn; ...
pRs->Open( "SELECT * FROM Customers", Conn, adOpenDynamic,
adLockReadOnly, adCmdText );

Error message:
error: class _com_ptr_t<class _com_IIID<struct _Connection,struct
__s_GUID const  _GUID_00000515_0000_0010_8000_00aa006d2ea4>>' to 'const
class _variant_t &'

 
 
 

ADO with C++? No way

Post by Matt Anderso » Sat, 27 Jun 1998 04:00:00


This is the way that I opwn my recordsets....

BOOL clDatabaseInterface::OpenRecordset(ADORecordset *pIRecordset,
                                        CString sSQL,
                                        CursorTypeEnum iType,
                                        CommandTypeEnum iCommandType)
{
  HRESULT hr;
  VARIANT varNull;
  COleVariant cvarSource(sSQL);

  if (pIRecordset != NULL)
    pIRecordset->Close();

  varNull.vt = VT_ERROR;
  varNull.scode = DISP_E_PARAMNOTFOUND;
  pIRecordset->putref_ActiveConnection(m_pIConnection);
  hr = pIRecordset->Open(cvarSource.Detach(), varNull, iType,
adLockOptimistic, iCommandType);
  if (!SUCCEEDED(hr))
  {
    SetADOError(m_pIConnection, hr);
    DatabaseStatus = unable_to_open_recordset;                // failed to
in open
    return FALSE;
  }

  return (TRUE);

Quote:}

Matt Anderson

 
 
 

1. C++, C++, C++, C++

JOB TITLE: C++ Developer
  SUBJECT: Join a young strong development team!!!
    JOB #: 29997AK

My client, a young Boston-based company that focuses on online commerce,
seeks developers to work on their advanced messaging network product.   In
this role, you will develop business and OLTP applications in UNIX/C++ in
a distributed environment.

You may be a match for this position if you have a BS in CS, or
equivalent, have at least 1 year C++ experience, have a proven track
record in object-oriented development and product development, and enjoy a
casual workplace.

If your qualifications match the above specifications, please send your
resume to:

Attn:           Ashleigh Kyle
Reference:      Job# 29997Ak

Fax:            781-639-0863
U.S. Mail:      New Dimensions in Technology, Inc.
                74 Atlantic Avenue, Suite 101

2. 8.3B install problem

3. Using ADO 2.1 / ADOX / ADO 2.0 with C++

4. VB6 & SQL Server 7/2000

5. Cursors problems

6. ADO ADO ADO ADO ADO VB examples / samples book wanted

7. Best way to implement an Audit Trail

8. C++ ADO and NT Authentication, SQL role

9. ADO vs ODBC for C++ app -- recomendations needed

10. Stored Procedure debugging from Visual Studio (C++/ADO)

11. SQL Query, using ADO \ Visule C++