#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();
}
}