_ConnectionPtr m_pConnection; // Connection
//----------------------------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// --------------------------------------------------------------
// 初始化OLE/COM并连接数据库
extern "C" __declspec(dllexport) PCHAR _cdecl ConnectToDB(PINT RtINT)
{
::CoInitialize(NULL);
*RtINT = 0;
//********** Initial OLE DLL *******************//
if(!AfxOleInit())
{
static CHAR RtMessage[255]={"ERROR! Init Ole DLL Fail!"};
AfxMessageBox( "ERROR! Init Ole DLL Fail!" );
return RtMessage;
}
//********* Initial Connection *****************//
m_pConnection.CreateInstance(__uuidof(Connection));
try
{
CString csOpen;
csOpen.Format("Provider=SQLOLEDB.1;Password=SDT#6;Persist Security Info=True;User ID=SDT;Initial Catalog=SMT;D