--> adCreateStructDoc = -2147483648,
adCreateNonCollection = 0,
adOpenIfExists = 33554432,
adCreateOverwrite = 67108864,
adFailIfNotExists = -1
};c:\documents and settings\administrator\my documents\measure\debug\msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned运行不能通过
错误:
“0x0040d468”指令引用的"0xcdcdcdcd"内存。该内存不能为“read”.
请教问题出在什么地方.
adCreateNonCollection = 0,
adOpenIfExists = 33554432,
adCreateOverwrite = 67108864,
adFailIfNotExists = -1
};c:\documents and settings\administrator\my documents\measure\debug\msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned运行不能通过
错误:
“0x0040d468”指令引用的"0xcdcdcdcd"内存。该内存不能为“read”.
请教问题出在什么地方.
请教解决方法。。急
_ConnectionPtr m_pConnection = NULL; //here!
try{
hr=m_pConnection.CreateInstance("ADODB.Connection");//创建Connection对象
if(SUCCEEDED(hr))
{//here!! _bstr_t("SmsSendBuff")
hr=m_pConnection->Open(/*cConnectStr,cUID,cPWD,*/_bstr_t("SmsSendBuff"),"sa",
"",0/*adModeUnknown*/);//连接数据库
}
_variant_t rec_affected;
m_pConnection->Execute(_bstr_t("select * from smssendbuff "),&rec_affected,0);
}
catch(_com_error e)
{
char cMsg[50];
sprintf(cMsg,"连接数据库失败!\r\n错误信息:%s",e.ErrorMessage());
AfxMessageBox(cMsg);
return;
}
{
if (!CDocument::OnNewDocument())
return FALSE; // TODO: add reinitialization code here
// (SDI documents will reuse this document)
m_strConnection = _T("Provider=MSDASQL.1;Data Source=ERC");
m_strCmdText = _T("select * from measure"); //Initialize the Recordset and binding pointers
m_pRs = NULL;
m_piAdoRecordBinding = NULL;
//Initialize the COM environment
::CoInitialize(NULL);
try
{
//Create the record set object
m_pRs.CreateInstance(__uuidof(Recordset)); //Open the record set object
m_pRs ->Open((LPCTSTR)m_strCmdText,(LPCTSTR)m_strConnection,
adOpenDynamic,adLockOptimistic,adCmdUnknown); //Get a pointer to the record binding interface
if (FAILED(m_pRs ->QueryInterface(__uuidof(IADORecordBinding),(LPVOID *)&m_piAdoRecordBinding)))
_com_issue_error(E_NOINTERFACE);
//Bind the record calss to the record set
m_piAdoRecordBinding ->BindToRecordset(&m_rsRecSet); //Get a pointer to the view
POSITION pos = GetFirstViewPosition();
CDbAdoView* pView = (CDbAdoView*)GetNextView(pos);
if (pView)
//Sync the data set with the form
pView ->RefreshBoundData(); }
// Any errors?
catch (_com_error &e)
{
// Display the error
GenerateError(e.Error(),e.Description());
} return TRUE;
}
-_-0