try{
CChickensDoc* pDoc=(CChickensDoc*)GetDocument();
m_ListView.DeleteAllItems();
pDoc->m_rec->MoveFirst();
CString str;
_variant_t var;
int flag;
int i = -1;
while(!(pDoc->m_rec->SSTEOF))
{
LV_ITEM lvitem;
lvitem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvitem.state = 0;
lvitem.stateMask = 0;
char temp[50];
lvitem.iItem = ++i;
lvitem.iSubItem = 0;
lvitem.pszText =itoa(i, temp, 10);
m_ListView.InsertItem(&lvitem);
var=pDoc->m_rec->GetCollect("id");//id号
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 1, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("checktime");//检斤时间
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 2, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("office");//单位
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 3, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("type");//类型
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 4, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("carnumber");//车号
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 5, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("grossweight");//毛重
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 6, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("grossweighttimes");//毛重次数
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 7, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("tareweight");//皮重
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 8, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("tareweighttimes");//皮重次数
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 9, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("musttime");//应到时间
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 10, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("starttime");//其挂时间
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 11, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("deductother");//扣其它
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 12, (LPCTSTR)str);
var=pDoc->m_rec->GetCollect("deductwater");//扣水
if(var.vt!=VT_NULL)
str=(LPCSTR)_bstr_t(var);
m_ListView.SetItemText(i, 13, (LPCTSTR)str);
.......
下面都一样了,数据项挺多的,我在数据库里就填写了id,和检斤时间,可是我读出来之后,数据除了id和检斤时间是对的,后面的数据都是和检斤时间一样的,怎么回事啊