根据组合单选按钮来决定操作.txt

来自「图像处理学习的一些心得」· 文本 代码 · 共 74 行

TXT
74
字号
void CDIALOG_PERSONNEL::OnButtondel() 
{
	// TODO: Add your control notification handler code here
	int choice=CDialog::GetCheckedRadioButton(IDC_RADIO1,IDC_RADIO4);
	if(choice==IDC_RADIO1)
	{
		int i=m_basic.GetHotItem();
		CString strSQL;
		if(i==-1){
			MessageBox("please choose a record first!");
		}
		else{
			int keyid=atoi(m_basic.GetItemText(i,0));
			strSQL.Format("delete from PERSONNEL where EMP_NO=%d",keyid);
			m_database.ExecuteSQL(strSQL);
			strSQL.Format("delete from PERSONNEL_PLAN where EMP_NO=%d",keyid);
			m_database.ExecuteSQL(strSQL);
			strSQL.Format("delete from SCORE where EMP_NO=%d",keyid);
			m_database.ExecuteSQL(strSQL);
			strSQL.Format("delete from COURSE_NEED where COURSE_NEED=%d",keyid);
			m_database.ExecuteSQL(strSQL);
			m_database.Close();
			RefreshData();
		}
	}
	else if(choice==IDC_RADIO2)
	{
		int i=m_plan.GetSelectionMark();//CListCtrl	m_plan;
		CString strSQL;
		if(i==-1){
			MessageBox("please choose a record first!");
		}
		else{
			int keyid=atoi(m_plan.GetItemText(i,1));
			strSQL.Format("delete from PERSONNEL_PLAN where COURSE_ID=%d",keyid);
			m_database.ExecuteSQL(strSQL);
			m_database.Close();
			RefreshData();
		}	
	}
	else if(choice==IDC_RADIO3)
	{
		int i=m_need.GetSelectionMark();
		CString strSQL;
		if(i==-1){
			MessageBox("please choose a record first!");
		}
		else{
			int keyid=atoi(m_need.GetItemText(i,0));
			strSQL.Format("delete from COURSE_NEED where COURSE_ID=%d",keyid);
			m_database.ExecuteSQL(strSQL);
			m_database.Close();
			RefreshData();
		}
	}
	else if(choice==IDC_RADIO4)
	{
		int i=m_score.GetSelectionMark();
		CString strSQL;
		if(i==-1){
			MessageBox("please choose a record first!");
		}
		else{
			int keyid=atoi(m_score.GetItemText(i,1));
			strSQL.Format("delete from SCORE where COURSE_ID=%d",keyid);
			m_database.ExecuteSQL(strSQL);
			m_database.Close();
			RefreshData();
		}
	}
	else{
		MessageBox("please choose a class first!");
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?