數(shù)據(jù)庫課程設計報告(員工培訓管理系統(tǒng))_第1頁
數(shù)據(jù)庫課程設計報告(員工培訓管理系統(tǒng))_第2頁
數(shù)據(jù)庫課程設計報告(員工培訓管理系統(tǒng))_第3頁
數(shù)據(jù)庫課程設計報告(員工培訓管理系統(tǒng))_第4頁
數(shù)據(jù)庫課程設計報告(員工培訓管理系統(tǒng))_第5頁
已閱讀5頁,還剩22頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、數(shù)據(jù)庫系統(tǒng)課程設計課題 班級 學號 姓名 指導教師 時間:2015.6.152015.6.261 系統(tǒng)需求分析1.1系統(tǒng)功能分析員工培訓系統(tǒng)需要實現(xiàn)的主要功能包括:l 企業(yè)總體培訓課程的設置和安排。l 允許員工根據(jù)自己的情況選擇合適的課程和上課時間。l 對選課結果進行統(tǒng)計報表。允許員工對最后選課結果的查詢。l 培訓考核成績的輸入和查詢。l 員工培訓效果的綜合報表。l 員工個人信息的修改。圖1、員工培訓管理系統(tǒng)功能模塊圖1.2系統(tǒng)功能模塊設計(劃分)本系統(tǒng)涉及到員工和培訓管理部門之間的交流,因此需要根據(jù)用戶的不同分成兩大功能模塊。這兩個模塊的功能和使用的權限完全不同。本系統(tǒng)功能模塊如圖1所示。1

2、.3與其它系統(tǒng)的關系圖2、培訓管理數(shù)據(jù)流程圖員工培訓系統(tǒng)可以為員工素質(zhì)技能的評價提供可靠的依據(jù),是職務評定的一個參考信息源。系統(tǒng)本身需要用到人事管理系統(tǒng)中的員工基本信息和部門信息等輔助資料,這些數(shù)據(jù)可以通過數(shù)據(jù)庫直接讀取。1.4數(shù)據(jù)流程圖員工培訓管理系統(tǒng)的數(shù)據(jù)流程如圖2所示。2 數(shù)據(jù)庫設計2.1數(shù)據(jù)庫需求分析根據(jù)系統(tǒng)數(shù)據(jù)流程圖,我們可以列出以下系統(tǒng)所需的數(shù)據(jù)項和數(shù)據(jù)結構:l 課程設置:編號、名稱、簡介、所用教材、上課地點、人數(shù)、上課時間l 選課結果:記錄編號、員工、課程、考核成績、評價、考核日期。所需的外部數(shù)據(jù)支持:l 人員信息:員工號、密碼、權限、姓名、部門、當前狀態(tài)等。l 部門設置:部門編

3、號、名稱等。2.2數(shù)據(jù)庫概念結構設計圖3是本系統(tǒng)所需數(shù)據(jù)的E-R模型圖。圖3、培訓管理E-R圖2.3數(shù)據(jù)庫邏輯結構設計根據(jù)E-R圖和數(shù)據(jù)庫需求分析,培訓管理系統(tǒng)需要創(chuàng)建2個主要的數(shù)據(jù)表:課程設置表和培訓安排表。對應這兩個表中的個別代碼字段,又需要創(chuàng)建2個代碼表:課程狀態(tài)代碼表和考核評價代碼表。這4個數(shù)據(jù)表的結構如表1至表4所示。員工信息和部門信息作為外部數(shù)據(jù)支持可以使用人事管理系統(tǒng)中建立的數(shù)據(jù)表,如表5和表6所示。表1 COURSE 課程設置表字段名數(shù)據(jù)類型是否可空說明ID課程編號NAME課程名TEACHER任課教師(外部關鍵字PERSON)INTRO課程簡介BOOK所用教材CLASSROOM

4、上課地點NUMBER課程上限人數(shù)CLASSTIME開課時間STATE狀態(tài)(外部關鍵字COURSE_STATE)表2 TRAINING_PLAN培訓安排表字段名數(shù)據(jù)類型是否可空說明ID編號PERSON員工(外部關鍵字PERSON)COURSE課程SCORE成績APPRAISEMENT評價(外部關鍵字APPRAISEMENT)EXAM_DATA考核日期表3 COURSE_STATE課程狀態(tài)代碼表字段名數(shù)據(jù)類型是否可空說明CODE狀態(tài)代碼DESCRIPTION描述表4 APPRISEMENT考核評價代碼表字段名數(shù)據(jù)類型是否可空說明CODE評價代碼DESCRIPTION描述表5 PERSON員工個人信

5、息表字段名數(shù)據(jù)類型是否可空說明ID員工號(主關鍵字)PASSWD密碼AUTHORITY用戶權限NAME姓名SEX性別BIRTHDAY生日DEPARTMENT所在部門JOB職務EDU_LEBEL受教育程度SPECIATY專業(yè)技能ADDRESS家庭住址TEL聯(lián)系電話EMAIL電子信箱STATE當前狀態(tài)(T-員工,F(xiàn)-非員工)REMARK備注表6 DEPARTMENT部門信息表字段名數(shù)據(jù)類型是否可空說明ID部門編號NAME部門名稱MANAGER部門經(jīng)理INTRO簡介2.4數(shù)據(jù)庫的建立2.4.1數(shù)據(jù)庫的建立2.4.2初始數(shù)據(jù)的輸入本系統(tǒng)中,初始數(shù)據(jù)包括課程狀態(tài)代碼和評價代碼,如表7至表8所示。表7 課

6、程狀態(tài)代碼代碼說明0選課中1進行中2已結束表8 考核評價代碼代碼說明0未考核1不及格2及格3良好4優(yōu)秀(以下各部分請設計者完成)。3 各功能模塊的設計與實現(xiàn)3.1功能說明本管理系統(tǒng)主要分為兩大部分:培訓管理應用程序和學員選課應用程序。培訓管理應用程序主要用于培訓中心的管理人員對培訓課程和培訓情況進行維護。此應用程序主要包括四項功能:課程設置、選課結果查詢修改、成績輸入、培訓成績統(tǒng)計報表。另外,系統(tǒng)需要有登錄窗口(用于權限認證)和導航窗口(用于連接各項功能)。學員選課應用程序包括個人信息修改、選課和成績查詢?nèi)椆δ?。(一)培訓管理管理應用程序功能說明(二)學員選課應用程序功能說明3.2用戶界面設

7、計完成數(shù)據(jù)庫創(chuàng)建和功能說明以后,我們可以進行下一步工作,既設計用戶界面。1、培訓管理應用程序登錄窗體的創(chuàng)建2、培訓管理應用程序主窗體的創(chuàng)建3、課程設置窗體的創(chuàng)建4、選課結果查詢窗體的創(chuàng)建5、學員名單報表窗體的創(chuàng)建6、考核評定結果窗體的創(chuàng)建7、培訓統(tǒng)計窗體的創(chuàng)建8、培訓成績報表窗體的創(chuàng)建9、學員選課客戶端界面的創(chuàng)建3.3各功能模塊的實現(xiàn)1、培訓管理應用程序數(shù)據(jù)模塊的創(chuàng)建2、培訓管理應用程序登錄程序的實現(xiàn)3、課程設置模塊的實現(xiàn)4、選課結果查詢的實現(xiàn)5、學員名單報表的實現(xiàn)6、考核評定結果的實現(xiàn)7、培訓統(tǒng)計的實現(xiàn)8、培訓成績報表的實現(xiàn)9、學員選課客戶端應用程序的創(chuàng)建4 系統(tǒng)實現(xiàn)基本方法:通過一個ado

8、控件與數(shù)據(jù)庫進行連接,一個datagrid控件顯示表信息。1 edit控件對應表的字段。button按鈕對應“查詢”、“更新”、“刪除”和“添加”。4.1登陸界面:/登陸按鈕功能/*1.首先連接數(shù)據(jù)庫2.通過sql語句獲得PERSON表的信息,得到與輸入賬號名相對應的賬號密碼(sql.Format(select * from person where P_ID = %s and P_PASSWD = %s,this-m_id,this-m_password);)3.判斷輸入的密碼與從數(shù)據(jù)庫中得到的密碼是否相一致4. 得到與輸入賬號名相對應的賬號權限5.判斷用戶的身份,選擇進入不同的功能界面*/

9、void CEmploymentDlg:OnButton1() this-UpdateData(true);/連接數(shù)據(jù)庫UpdateData(TRUE);_ConnectionPtr m_pConnection;:CoInitialize(NULL);trym_pConnection.CreateInstance(ADODB.Connection);_bstr_t strConn=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Employee training m

10、anagement system;Data Source=520-002;m_pConnection-Open(strConn,adModeUnknown);catch(_com_error e):CoUninitialize();AfxMessageBox(e.ErrorMessage();return ;/定義sql查詢CString sql;variant_t RecordsAffected; _RecordsetPtr m_pRecordset; sql.Format(select * from person where P_ID = %s and P_PASSWD = %s,this

11、-m_id,this-m_password);/執(zhí)行SQL查詢m_pRecordset = m_pConnection-Execute(_bstr_t)sql,&RecordsAffected,adCmdText);/如果找到if(!m_pRecordset-adoEOF) RecordsAffected=m_pRecordset-GetCollect(p_authority);CString authority=(LPCSTR)_bstr_t(RecordsAffected);/int i=(int)RecordsAffected.iVal;if(authority=employee)thi

12、s-ShowWindow(SW_HIDE);id=this-m_id;employer dlg;dlg.DoModal();this-ShowWindow(SW_SHOW);else this-ShowWindow(SW_HIDE);teacher dlg;dlg.DoModal();this-ShowWindow(SW_SHOW);else MessageBox(用戶名或密碼有誤);/退出按鈕功能,直接調(diào)用exit(0)退出整個程序void CEmploymentDlg:OnButton2() exit(0);/*1.這個界面主要是有三個按鈕,用來選擇進入不同的功能區(qū)*/void emplo

13、yer:OnButton1() this-ShowWindow(SW_HIDE);/當前界面隱藏employer_chioce dlg; /需要添加該C*Dlg.h頭文件,否則編譯通不過dlg.DoModal();this-ShowWindow(SW_SHOW);void employer:OnButton2() this-ShowWindow(SW_HIDE);/當前界面隱藏employer_score dlg; /需要添加該C*Dlg.h頭文件,否則編譯通不過dlg.DoModal();this-ShowWindow(SW_SHOW);void employer:OnButton3() t

14、his-ShowWindow(SW_HIDE);/當前界面隱藏employer_information dlg; /需要添加該C*Dlg.h頭文件,否則編譯通不過dlg.DoModal();this-ShowWindow(SW_SHOW);void employer:OnButton4() exit(0);/*點擊顯示個人課程,會顯示出個人課程這部份功能主要有:1.查找2.增加3.刪除 */增加選擇課程/*1.連接數(shù)據(jù)庫2.定義sql1,sql2用于獲得信息,和添加課程sql.Format(select * from course where C_ID = %s,this-m_add_id);

15、sql2.Format(SELECT C_NAME,COUNT(C_ID) as num FROM TRAINING_PLAN,PERSON,COURSE WHERE P_ID=T_PERSON and C_ID=T_COURSE GROUP BY C_NAME);3.差錯控制選課人數(shù)與選課上限人數(shù)4.其余的功能和增加功能只是sql語句的差別,就不詳細描述了*/void employer_chioce:OnButton1() UpdateData(TRUE);_ConnectionPtr m_pConnection;:CoInitialize(NULL);trym_pConnection.Cr

16、eateInstance(ADODB.Connection);_bstr_tstrConn = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Employee training management system;Data Source=520-002;m_pConnection-Open(strConn,adModeUnknown); catch(_com_error e):CoUninitialize();AfxMessageBox(e.ErrorMessag

17、e();return;/定義sql查詢CString sql,sql2;variant_t RecordsAffected,RecordsAffected2;_RecordsetPtr m_pRecordset,m_pRecordset2; sql.Format(select * from course where C_ID = %s,this-m_add_id);sql2.Format(SELECT C_NAME,COUNT(C_ID) as num FROM TRAINING_PLAN,PERSON,COURSE WHERE P_ID=T_PERSON and C_ID=T_COURSE

18、GROUP BY C_NAME);/執(zhí)行SQL查詢m_pRecordset = m_pConnection-Execute(_bstr_t)sql,&RecordsAffected,adCmdText);m_pRecordset2 = m_pConnection-Execute(_bstr_t)sql2,&RecordsAffected2,adCmdText);RecordsAffected=m_pRecordset-GetCollect(C_NUMBER);CString number=(LPCSTR)_bstr_t(RecordsAffected);RecordsAffected2=m_p

19、Recordset2-GetCollect(num);CString num=(LPCSTR)_bstr_t(RecordsAffected2);if(numExecute(strAdd,&ra,adCmdText);m_pConnection-Close();/以下顯示當前數(shù)據(jù)CString strSQL=SELECT P_NAME,C_ID,C_NAME,C_TEACHER,C_CLASSROOM,C_CLASSTIME,C_STATE,T_EXAM_DATE FROM TRAINING_PLAN,PERSON,COURSE,APPRISEMENT WHERE P_ID=T_PERSON

20、AND C_ID=T_COURSE AND A_CODE=T_APPRISEMENT and T_PERSON= +id;m_adodc2.SetRecordSource(strSQL);m_adodc2.Refresh();m_datagrid2.ShowWindow(SW_SHOW);AfxMessageBox(選課成功);UpdateData(FALSE);else AfxMessageBox(選課失敗,選課人數(shù)已達到上限!);/顯示個人選擇課程void employer_chioce:OnButton4() / TODO: Add your control notification h

21、andler code hereUpdateData(TRUE);CString tmpStr,strSQL=SELECT P_NAME,C_ID,C_NAME,C_TEACHER,C_CLASSROOM,C_CLASSTIME,C_STATE,T_EXAM_DATE FROM TRAINING_PLAN,PERSON,COURSE,APPRISEMENT WHERE P_ID=T_PERSON AND C_ID=T_COURSE AND A_CODE=T_APPRISEMENT and T_PERSON= +id;m_adodc2.SetRecordSource(strSQL);m_adod

22、c2.Refresh();m_datagrid2.ShowWindow(SW_SHOW);UpdateData(FALSE);/刪除選擇課程void employer_chioce:OnButton2() / TODO: Add your control notification handler code hereUpdateData(TRUE);_ConnectionPtr m_pConnection;:CoInitialize(NULL);trym_pConnection.CreateInstance(ADODB.Connection);_bstr_tstrConn = Provider=

23、SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Employee training management system;Data Source=520-002;m_pConnection-Open(strConn,adModeUnknown); catch(_com_error e):CoUninitialize();AfxMessageBox(e.ErrorMessage();return;/以下插入數(shù)據(jù)_variant_t ra;_bstr_t strAdd=delete fro

24、m training_plan where t_person =+id+ and t_course = +m_delete_id+;/AfxMessageBox(strAdd); return;m_pConnection-Execute(strAdd,&ra,adCmdText);m_pConnection-Close();/以下顯示當前數(shù)據(jù)CString tmpStr,strSQL=SELECT P_NAME,C_ID,C_NAME,C_TEACHER,C_CLASSROOM,C_CLASSTIME,C_STATE,T_EXAM_DATE FROM TRAINING_PLAN,PERSON,

25、COURSE,APPRISEMENT WHERE P_ID=T_PERSON AND C_ID=T_COURSE AND A_CODE=T_APPRISEMENT and T_PERSON= +id;m_adodc2.SetRecordSource(strSQL);m_adodc2.Refresh();m_datagrid2.ShowWindow(SW_SHOW);AfxMessageBox(刪除課程成功);UpdateData(FALSE);/查找課程IDvoid employer_chioce:OnButton5() UpdateData(TRUE);CString str=select

26、* from course where c_name like %+m_name+%;m_adodc1.SetRecordSource(str);m_adodc1.Refresh();UpdateData(FALSE);void employer_chioce:OnButton6() exit(0);void employer_chioce:OnButton7() this-ShowWindow(SW_HIDE);employer dlg;dlg.DoModal();this-ShowWindow(SW_SHOW);void employer_information:OnButton1() U

27、pdateData(TRUE);CString strSQL=SELECT * from PERSON where P_ID= +id;m_adodc1.SetRecordSource(strSQL);m_adodc1.Refresh();m_datagrid1.ShowWindow(SW_SHOW);UpdateData(FALSE);void employer_information:OnButton2() MessageBox(更新個人信息成功!);UpdateData(TRUE);_variant_t ra;_bstr_t strAdd=UPDATE PERSON SET ;strAd

28、d=strAdd+ p_passwd = +m_passwd+,;strAdd=strAdd+ P_NAME = +m_name+,;strAdd=strAdd+ p_sex = +m_sex+,;strAdd=strAdd+ p_birahday = +m_birahday+,;strAdd=strAdd+ p_edu_level = +m_edu_level+,;strAdd=strAdd+ p_speciaty = +m_speciaty+,;strAdd=strAdd+ p_address = +m_address+,;strAdd=strAdd+ p_tel = +m_tel+,;s

29、trAdd=strAdd+ p_email = +m_email+,;strAdd=strAdd+ p_remark = +m_pemark+;strAdd=strAdd+ where+ P_ID = +id+;m_adodc1.SetRecordSource(strAdd);m_adodc1.Refresh();MessageBox(更新個人信息成功!);UpdateData(FALSE);BEGIN_EVENTSINK_MAP(employer_information, CDialog) /AFX_EVENTSINK_MAP(employer_information)ON_EVENT(em

30、ployer_information, IDC_DATAGRID1, -601 /* DblClick */, OnDblClickDatagrid1, VTS_NONE)/AFX_EVENTSINK_MAPEND_EVENTSINK_MAP()void employer_information:OnDblClickDatagrid1() UpdateData(TRUE);int ColNum = 2;CString colVal;CColumns cols; /要包含的文件頭COlumns.hCColumn col; /要包含的文件頭COlumn.hVARIANT v_ColNum,v_Va

31、lue;cols = m_datagrid1.GetColumns(); /調(diào)用GetColumns 返回CDataGrid對應的CColumns對象v_ColNum.vt = VT_I2;v_ColNum.iVal = 1; /設置列編號col = cols.GetItem(v_ColNum);/根據(jù)列編號返回CColumn 對象v_Value = col.GetValue();/讀取列值m_passwd = v_Value.bstrVal;v_ColNum.iVal = 3;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_na

32、me = v_Value.bstrVal;v_ColNum.iVal = 4;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_sex = v_Value.bstrVal;v_ColNum.iVal = 5;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_birahday = v_Value.bstrVal;v_ColNum.iVal = 8;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_edu_leve

33、l = v_Value.bstrVal;v_ColNum.iVal = 9;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_speciaty = v_Value.bstrVal;v_ColNum.iVal = 10;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_address = v_Value.bstrVal;v_ColNum.iVal = 11;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_tel

34、 = v_Value.bstrVal;v_ColNum.iVal = 12;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_email = v_Value.bstrVal;v_ColNum.iVal = 14;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_pemark = v_Value.bstrVal;UpdateData(FALSE);void employer_information:OnButton4() this-ShowWindow(SW_HIDE);e

35、mployer dlg;dlg.DoModal();this-ShowWindow(SW_SHOW);void employer_information:OnButton6() exit(0);void teacher:OnButton1() this-ShowWindow(SW_HIDE);tercher_course dlg;dlg.DoModal();this-ShowWindow(SW_SHOW);void teacher:OnButton2() this-ShowWindow(SW_HIDE);tercher_score dlg;dlg.DoModal();this-ShowWind

36、ow(SW_SHOW);void teacher:OnButton3() this-ShowWindow(SW_HIDE);tercher_result dlg;dlg.DoModal();this-ShowWindow(SW_SHOW);void teacher:OnButton4() this-ShowWindow(SW_HIDE);tercher_all dlg;dlg.DoModal();this-ShowWindow(SW_SHOW);void teacher:OnButton5() exit(0);/新增void tercher_course:OnButton1() UpdateD

37、ata(TRUE);_ConnectionPtr m_pConnection;:CoInitialize(NULL);trym_pConnection.CreateInstance(ADODB.Connection);_bstr_tstrConn=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Employee training management system;Data Source=520-002;m_pConnection-Open(strConn,adMo

38、deUnknown);catch(_com_error e):CoUninitialize();AfxMessageBox(e.ErrorMessage();return;_variant_t ra;_bstr_t strAdd=INSERT INTO COURSE VALUES(;strAdd=strAdd+m_c_id+,;strAdd=strAdd+m_c_name+,;strAdd=strAdd+m_c_teacher+,;strAdd=strAdd+m_c_intro+,;strAdd=strAdd+m_c_book+,;strAdd=strAdd+m_c_classroom+,;s

39、trAdd=strAdd+m_c_number+,;strAdd=strAdd+m_c_classtime+,;strAdd=strAdd+m_c_state+);/清空輸入框m_c_id= ;m_c_name= ;m_c_teacher= ;m_c_intro= ;m_c_book= ;m_c_classroom= ;m_c_number= ;m_c_classtime= ;m_c_state= ;m_pConnection-Execute(strAdd,&ra,adCmdText);m_pConnection-Close();m_adodc1.SetRecordSource(select

40、* from COURSE);m_adodc1.Refresh();UpdateData(FALSE);/修改void tercher_course:OnButton2() UpdateData(TRUE);_ConnectionPtr m_pConnection;:CoInitialize(NULL);/在ADO操作中建議語句中要常用到try.catch()來捕獲錯誤信息/因為它有時會經(jīng)常出現(xiàn)一些想不到的錯誤trym_pConnection.CreateInstance(ADODB.Connection);_bstr_tstrConn = Provider=SQLOLEDB.1;Integr

41、ated Security=SSPI;Persist Security Info=False;Initial Catalog=Employee training management system;Data Source=520-002;m_pConnection-Open(strConn,adModeUnknown); catch(_com_error e):CoUninitialize();AfxMessageBox(e.ErrorMessage();return;/以下插入數(shù)據(jù)_variant_t ra;_bstr_t strAdd=UPDATE COURSE SET ;strAdd=s

42、trAdd+ C_NAME = +m_c_name+,;strAdd=strAdd+ C_TEACHER = +m_c_teacher+,;strAdd=strAdd+ C_INTRO = +m_c_intro+,;strAdd=strAdd+ C_BOOK = +m_c_book+,;strAdd=strAdd+ C_CLASSROOM = +m_c_classroom+,;strAdd=strAdd+ C_NUMBER = +m_c_number+,;strAdd=strAdd+ C_CLASSTIME = +m_c_classtime+,;strAdd=strAdd+ C_STATE =

43、 +m_c_state+;strAdd=strAdd+ where+ C_ID = +m_c_id+;m_pConnection-Execute(strAdd,&ra,adCmdText);m_pConnection-Close();/以下顯示當前數(shù)據(jù)m_adodc1.SetRecordSource( SELECT * FROM COURSE );m_adodc1.Refresh();AfxMessageBox(成功更新數(shù)據(jù));UpdateData(FALSE);/刪除void tercher_course:OnButton4() UpdateData(TRUE);_ConnectionPtr

44、 m_pConnection;:CoInitialize(NULL);trym_pConnection.CreateInstance(ADODB.Connection);_bstr_tstrConn=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Employee training management system;Data Source=520-002;m_pConnection-Open(strConn,adModeUnknown);catch(_com_er

45、ror e):CoUninitialize();AfxMessageBox(e.ErrorMessage();return ;_variant_t ra;_bstr_t strAdd=delete from COURSE where C_ID=;strAdd=strAdd+m_c_id;m_pConnection-Execute(strAdd,&ra,adCmdText);m_pConnection-Close();m_adodc1.SetRecordSource(select * from COURSE);m_adodc1.Refresh();m_c_id= ;m_c_name= ;m_c_

46、teacher= ;m_c_intro= ;m_c_book= ;m_c_classroom= ;m_c_number= ;m_c_classtime= ;m_c_state= ;UpdateData(FALSE);BEGIN_EVENTSINK_MAP(tercher_course, CDialog) /AFX_EVENTSINK_MAP(tercher_course)ON_EVENT(tercher_course, IDC_DATAGRID1, -601 /* DblClick */, OnDblClickDatagrid1, VTS_NONE)/AFX_EVENTSINK_MAPEND_

47、EVENTSINK_MAP()void tercher_course:OnDblClickDatagrid1() / TODO: Add your control notification handler code hereUpdateData(TRUE);int ColNum = 2;CString colVal;CColumns cols; /要包含的文件頭COlumns.hCColumn col; /要包含的文件頭COlumn.hVARIANT v_ColNum,v_Value;cols = m_datagrid1.GetColumns(); /調(diào)用GetColumns 返回CDataG

48、rid對應的CColumns對象v_ColNum.vt = VT_I2;v_ColNum.iVal = 0;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_c_id = v_Value.bstrVal;v_ColNum.iVal = 1;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_c_name = v_Value.bstrVal;v_ColNum.iVal = 2;col = cols.GetItem(v_ColNum);v_Value = col.GetValu

49、e();m_c_teacher = v_Value.bstrVal;v_ColNum.iVal = 3;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_c_intro = v_Value.bstrVal;v_ColNum.iVal = 4;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_c_book = v_Value.bstrVal;v_ColNum.iVal = 5;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_c_classroom = v_Value.bstrVal;v_ColNum.iVal = 6;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_c_number = v_Value.bstrVal;v_ColNum.iVal = 7;col = cols.GetItem(v_ColNum);v_Value = col.GetValue();m_c

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論