// TODO: Add extra validation here
UpdateData(TRUE);
CString strSQL;
// CResourceSet m_recordset(&m_database);
int i=1;
int flag=0;
while(!flag){
CBookSet m_recordset(&m_database);
strSQL.Format("select * from BOOK where BOOK_ID=%d",i);
m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL);
if(m_recordset.GetRecordCount()==0){
strSQL.Format("insert into BOOK values(%d,\'%s\',\'%s\',%d,%d,%d,%f)",i,m_name,m_author,0,m_courseid,m_quantity,m_price);
m_database.ExecuteSQL(strSQL);
m_database.Close();
CDialog::OnOK();
flag=1;
}
i++;
//m_recordset.Delete();
本文地址:http://com.8s8s.com/it/it717.htm