Udostępnij za pośrednictwem


CDataConnection::operator CDataSource&

Returns a reference to the contained CDataSource object.

operator const CDataSource&() throw( );

Remarks

This operator returns a reference to the contained CDataSource object, allowing you to pass a CDataConnection object where a CDataSource reference is expected.

Example

If you have a function (such as func below) that takes a CDataSource reference, you can use CDataSource& to pass a CDataConnection object instead.

void SourceFunc(const CDataSource& theSource)
{
   CComVariant var;
   theSource.GetProperty(DBPROPSET_DATASOURCEINFO, DBPROP_DATASOURCENAME, &var);
}
CDataConnection dc;
dc.Open(szInit);
SourceFunc(dc);

Requirements

Header: atldbcli.h

See Also

Reference

CDataConnection Class

CDataConnection::operator CDataSource*

Other Resources

CDataConnection Members