void CFiveDlg::OnMenuName() { // TODO: Add your command handler code here CNameDlg dlg; if ( IDOK == dlg.DoModal() ) { SetDlgItemText( IDC_ST_ME, m_Table.m_strMe ); } }
void CDialogPlacePart::OnButtonNewlib() { // TODO: Add your control notification handler code here CNameDlg dlg; if(dlg.DoModal()==IDOK){ if(!m_db.IsOpen()){ TCHAR sConnect[1024]; g_GetConnectString(sConnect,1024); //Connect to database m_db.OpenEx(sConnect); } m_db.ExecuteSQL(_T("INSERT INTO tbLibrary (nNameLib) VALUES ('") + dlg.m_Name + _T("')")); m_cbLibrary.ResetContent(); CRecordset rsLib(&m_db); rsLib.Open(CRecordset::forwardOnly, _T("SELECT * FROM tbLibrary")); CString strName; while(!rsLib.IsEOF()){ CString str; rsLib.GetFieldValue(_T("nNameLib"), strName); int nIndex=m_cbLibrary.AddString(strName); rsLib.GetFieldValue(_T("iIdLib"), str); m_cbLibrary.SetItemData(nIndex,_wtoi(str)); rsLib.MoveNext(); } int nIndex=m_cbLibrary.FindString(-1,strName); m_cbLibrary.SetCurSel(nIndex); m_iLibrary=m_cbLibrary.GetItemData(nIndex); rsLib.Close(); UpdatePartList(); m_db.Close(); } }