void CSGMSView::Calculate()
{
double english, maths, lmaths, pascl, cplus, struc=0;  m_pSet->MoveFirst();
while (!m_pSet->IsEOF())
{   
                   m_pSet->Edit();
if (m_pSet->m_english >= 60)
english = (m_pSet->m_english - 50)/10;
if (m_pSet->m_maths >= 60)
maths = (m_pSet->m_maths - 50)/10;
if (m_pSet->m_Lmaths >= 60)
lmaths = (m_pSet->m_Lmaths - 50)/10;
if (m_pSet->m_pascal >= 60)
pascl = (m_pSet->m_pascal - 50)/10;
if (m_pSet->m_struct >= 60)
struc = (m_pSet->m_struct - 50)/10;
if (m_pSet->m_cPlus >= 60)
cplus = (m_pSet->m_cPlus - 50)/10;

m_pSet->m_AvePoint = (english + maths + lmaths + pascl + cplus + struc)/6;
        m_pSet->m_totalpoint = english*4 + maths*4 + lmaths*3.5 + pascl*3.5 + cplus*3.5 + struc*3.5 + m_pSet->m_moral;
m_pSet->MoveNext();

m_pSet->Update();
UpdateData(FALSE);
    m_pSet->Requery();}

解决方案 »

  1.   

    总是看不全,真不爽。void CSGMSView::Calculate()
    {
    double english, maths, lmaths, pascl, cplus, struc=0;  m_pSet->MoveFirst();
    while (!m_pSet->IsEOF())
    {   
                       m_pSet->Edit();
    if (m_pSet->m_english >= 60)
    english = (m_pSet->m_english - 50)/10;
    if (m_pSet->m_maths >= 60)
    maths = (m_pSet->m_maths - 50)/10;
    if (m_pSet->m_Lmaths >= 60)
    lmaths = (m_pSet->m_Lmaths - 50)/10;
    if (m_pSet->m_pascal >= 60)
    pascl = (m_pSet->m_pascal - 50)/10;
    if (m_pSet->m_struct >= 60)
    struc = (m_pSet->m_struct - 50)/10;
    if (m_pSet->m_cPlus >= 60)
    cplus = (m_pSet->m_cPlus - 50)/10;

    m_pSet->m_AvePoint = (english + maths + lmaths + pascl + cplus + struc)/6;
            m_pSet->m_totalpoint = english*4 + maths*4 + lmaths*3.5 + pascl*3.5 + cplus*3.5 + struc*3.5 + m_pSet->m_moral;
    m_pSet->MoveNext();

    m_pSet->Update();
    UpdateData(FALSE);
        m_pSet->Requery();}
      

  2.   

    不知道你要干吗?按理你用 m_pSet->Edit();
    好象是添加一条纪录,不过你好像是添加很多纪录阿
    说情出问题
      

  3.   

    Edit()后不能移动游标,需要立即更新 Update()m_pSet->Update(); // 把这个语句插入到MoveNext();前边
    m_pSet->MoveNext();