提示IDispatch error #3088 "; 是哪里错了呢
笑掠残月 2011-10-17 06:18:41 代码如下:
UpdateData();
CTime tm, tmEnd; // 时间变量
CString sql; // 数据库变量
CString str, strDate, DateEnd; // 日期变量
CString itemtext; //文本内容
int row = 0; //定义行数
int count = 1; //定义列数
m_DataList.DeleteAllItems(); //清空列表数据
m_DTPStart.GetTime(tm);
str = tm.Format("%Y-%m-%d");
sql.Format("select PartID, PartName, PNweight, PLength, PBmpPath from Parts where PartDate = '%s' order by PartID ACS", str);
m_AdoConn.OnInitADOConn();
m_pRs = m_AdoConn.GetRecordSet((_bstr_t)sql); //获取结果表记录
if( m_pRs->adoEOF )
{
MessageBox("表内数据为空!", "提示", MB_OK | MB_ICONINFORMATION);
return;
}
while( ! m_pRs->adoEOF )
{
m_DataList.InsertItem(row, ""); //在列表视图控件中插入一个新项
for (int index = 0; index < 5; index++)
{
//获取数据库里对应的内容
itemtext = (TCHAR*)(_bstr_t)m_pRs->GetFields()->GetItem((long)index)->Value;
//讲文本内容插入行列
m_DataList.SetItemText(row, count, itemtext);
count++;
}
count = 1;
row++;
m_pRs->MoveNext();
}
m_AdoConn.ExitConn();
运行后就一直提示IDispatch error #3088 ";,sql字段我检查了也没检查出什么问题。是哪里错了呢?