保存数据到数据库
void CWork::GradeSaveToDatabase() { CString sql; sql.Format("SELECT * FROM yeya_grade"); //strTemp = strA.AllocSysString();//strTemp是什么 ADOCon m_AdoCon; m_AdoCon.OnInitADOCon(); m_AdoCon.m_pRecordset = m_AdoCon.GetRecordSet((_bstr_t)sql); m_AdoCon.m_pRecordset->AddNew(); //数据插入 m_AdoCon.m_pRecordset->PutCollect("workno", (_bstr_t)m_workno); m_AdoCon.m_pRecordset->PutCollect("Appearance", (_bstr_t)m_appear); m_AdoCon.m_pRecordset->PutCollect("Name", (_bstr_t)m_name); m_AdoCon.m_pRecordset->PutCollect("Number", (_bstr_t)m_number); m_AdoCon.m_pRecordset->PutCollect("Grade", (_bstr_t)m_grade); m_AdoCon.m_pRecordset->Update(); //断开与数据库的连接 m_AdoCon.ExitConnect(); AfxMessageBox("保存评级成功!"); }