编译出错怎么改,高手指点
编译出错怎么改,高手指点
void CDAOView::OnStuffView()
{
// TODO: Add your command handler code here
//设置当前操作的数据库表名称
m_strTableName=_T("物品");
//监督DAO数据库对象的有效性,并在记录集对象打开时关闭记录集
if(!m_pDatabase->IsOpen())return;
if(!m_pRecordset)return;
if(m_pRecordset->IsOpen())m_pRecordset->Close();
//清除所有视图上的显示
CListCtrl & ctlList=(CListCtrl&)GetListCtrl();
EraseList();
//取表的结构信息
CDaoFieldInfo fieldInfo;
int nFields;
CDaoTableDef td(m_pDatabase);
try
{
td.Open(m_strTableName);
nFields=td.GetFieldCount();
for(int j=0;jReportError();
e->Delete();
return;
}
td.Close();
//取表的数据
int nItem=0;
try
{
CString strSelect(_T("Select * From ["));
strSelect+=m_strTableName;
strSelect += _T("]");
m_pRecordset->Open(dbOpenDynaset,strSelect);
while(!m_pRecordset->IsEOF())
{
COleVariant var;
var=m_pRecordset->GetFieldValue(0);
ctlList.InsertItem(nItem,CCrack::strVARIANT(var));
for(int i=0;iGetFieldValue(i);
ctlList.SetItemText(nItem,i,CCrack::strVARIANT(var));
}
nItem++;
m_pRecordset->MoveNext();
}
}
catch(CDaoException *e)
{
e->ReportError();
e->Delete();
return;
}
//显示信息
CString strRecCount;
strRecCount.Format(_T("显示了%d条记录。"),nItem);
UpdateWindow();
if(nItem>=MAXRECORDS) MessageBox(strRecCount);
((CFrameWnd *)AfxGetMainWnd())->SetMessageText(strRecCount);
}
--------------------Configuration: DAO - Win32 Debug--------------------
Compiling...
DAOView.cpp
E:\c\Dao\DAOView.cpp(141) : error C2065: 'EraseList' : undeclared identifier
E:\c\Dao\DAOView.cpp(176) : error C2653: 'CCrack' : is not a class or namespace name
E:\c\Dao\DAOView.cpp(176) : error C2065: 'strVARIANT' : undeclared identifier
E:\c\Dao\DAOView.cpp(180) : error C2653: 'CCrack' : is not a class or namespace name
E:\c\Dao\DAOView.cpp(196) : error C2065: 'MAXRECORDS' : undeclared identifier
执行 cl.exe 时出错.
DAO.exe - 1 error(s), 0 warning(s)
{
// TODO: Add your command handler code here
//设置当前操作的数据库表名称
m_strTableName=_T("物品");
//监督DAO数据库对象的有效性,并在记录集对象打开时关闭记录集
if(!m_pDatabase->IsOpen())return;
if(!m_pRecordset)return;
if(m_pRecordset->IsOpen())m_pRecordset->Close();
//清除所有视图上的显示
CListCtrl & ctlList=(CListCtrl&)GetListCtrl();
EraseList();
//取表的结构信息
CDaoFieldInfo fieldInfo;
int nFields;
CDaoTableDef td(m_pDatabase);
try
{
td.Open(m_strTableName);
nFields=td.GetFieldCount();
for(int j=0;jReportError();
e->Delete();
return;
}
td.Close();
//取表的数据
int nItem=0;
try
{
CString strSelect(_T("Select * From ["));
strSelect+=m_strTableName;
strSelect += _T("]");
m_pRecordset->Open(dbOpenDynaset,strSelect);
while(!m_pRecordset->IsEOF())
{
COleVariant var;
var=m_pRecordset->GetFieldValue(0);
ctlList.InsertItem(nItem,CCrack::strVARIANT(var));
for(int i=0;iGetFieldValue(i);
ctlList.SetItemText(nItem,i,CCrack::strVARIANT(var));
}
nItem++;
m_pRecordset->MoveNext();
}
}
catch(CDaoException *e)
{
e->ReportError();
e->Delete();
return;
}
//显示信息
CString strRecCount;
strRecCount.Format(_T("显示了%d条记录。"),nItem);
UpdateWindow();
if(nItem>=MAXRECORDS) MessageBox(strRecCount);
((CFrameWnd *)AfxGetMainWnd())->SetMessageText(strRecCount);
}
--------------------Configuration: DAO - Win32 Debug--------------------
Compiling...
DAOView.cpp
E:\c\Dao\DAOView.cpp(141) : error C2065: 'EraseList' : undeclared identifier
E:\c\Dao\DAOView.cpp(176) : error C2653: 'CCrack' : is not a class or namespace name
E:\c\Dao\DAOView.cpp(176) : error C2065: 'strVARIANT' : undeclared identifier
E:\c\Dao\DAOView.cpp(180) : error C2653: 'CCrack' : is not a class or namespace name
E:\c\Dao\DAOView.cpp(196) : error C2065: 'MAXRECORDS' : undeclared identifier
执行 cl.exe 时出错.
DAO.exe - 1 error(s), 0 warning(s)