|
以下是自己写的一段小程序,运行的时候总是不能进入到switch语句的分支内,即不会有Refreshing11!的提示。数据库内已经存入数据,只是想在一个ClistCtrl控件中显示其数据。
请问问题出在什么地方?
void CTCPClientDlg::RefreshDB()
{
CEOID ceOid;
WORD wProps;
DWORD dwRecSize;
PBYTE pBuff;
PCEPROPVAL pRecord;
SAVEDATA *pDBData;
int iRecordCount=GetRecordCount(&m_ceGuid,m_ceOid);//获得记录数量
DWORD dwIndex;
CListCtrl *pListCtrl=(CListCtrl*)GetDlgItem(IDC_LST_DBDATA);
pListCtrl->DeleteAllItems();
//AfxMessageBox(_T("Refreshing1"));
for(int k=0;k
{
ceOid=CeSeekDatabase(m_hDB,CEDB_SEEK_BEGINNING,k,&dwIndex);
//AfxMessageBox(_T("Refreshing4!"));
ASSERT(ceOid!=0);
pBuff=0;
ceOid=CeReadRecordProps(m_hDB,CEDB_ALLOWREALLOC,&wProps,NULL,&(LPBYTE)pBuff,&dwRecSize);
ASSERT(ceOid!=0);
pRecord=(PCEPROPVAL)pBuff;
pDBData=new SAVEDATA;
CString str;
str.Format(_T("Refreshing5,and the wProps=%d,the count=%d"),wProps,iRecordCount);
AfxMessageBox(str);
for(int i=0;i
{
AfxMessageBox(_T("Refreshing10!"));
switch(pRecord->propid)///////////////???????????
{
AfxMessageBox(_T("Refreshing11!"));
case PID_RECVSTR:
{
// wcscpy((unsigned short*)pDBData->RecvStr,(unsigned short*)pRecord->val.blob.lpb);
break;
}
AfxMessageBox(_T("Refreshing8!"));
case PID_RECVLEN:
{
pDBData->len=pRecord->val.iVal;
break;
}
AfxMessageBox(_T("Refreshing9!"));
}
pRecord++;
AfxMessageBox(_T("Refreshing6!"));
}
LocalFree(pBuff);
//AfxMessageBox(_T("Refreshing3!"));
TCHAR szStature[5];
_itow(pDBData->len,szStature,10);
pListCtrl->SetItemText(k,0,(unsigned short *)szStature);
// pListCtrl->SetItemText(k,1,(const unsigned short *)pDBData->RecvStr);
delete pDBData;
}
AfxMessageBox(_T("Refreshing2!"));
return;
}
|
|