#include <atl/atlbase.h>
#include <msdasc.h>
#include <adodb.hpp>
WideString BuildConnectionStr()
{
WideString ConnectionStr;
CComPtr<IDataSourceLocator> pDsl;
CComQIPtr<_Connection> pConn;
CoInitialize(NULL);
try
{
if(S_OK ==pDsl.CoCreateInstance(__uuidof(DataLinks)))
{
if(S_OK == pDsl->PromptNew((IDispatch**)&pConn))
{
pConn->Get_ConnectionString(ConnectionStr);
return ConnectionStr;
}
}
}
__finally
{
CoUninitialize();
}
}
本文地址:http://com.8s8s.com/it/it27878.htm