【正文】
Then End If Call viewData End Sub Private Sub updateCommand_Click() Dim txtSQL As String Dim MsgText As String Dim mrcc As If mcclean Then MsgBox 請先修改學籍信息 , vbOKOnly + vbExclamation, 警告 Exit Sub End If 23 ? (這部分修改學生學籍信息的代碼類似于添加學生學籍信息的代碼,在這里將不再贅述 ) End Sub 在該模塊中選擇“查詢學籍信息”將出現(xiàn)圖 55所示界面,在這個界面上可以查詢系統(tǒng)中所有學生的學籍信息。具體的代碼如下所示。 圖 55 查詢學籍信息模塊 圖 Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdInquire_Click() Dim txtSQL As String Dim MsgText As String Dim dd(4) As Boolean Dim mrc As txtSQL = select * from student_Info where If Check1(0).Value Then If Trim() = Then sMeg = 學號不能為空 24 MsgBox sMeg, vbOKOnly + vbExclamation, 警告 Exit Sub Else If Not IsNumeric(Trim()) Then MsgBox 請輸入數(shù)字! , vbOKOnly + vbExclamation, 警告 Exit Sub End If dd(0) = True txtSQL = txtSQL amp。 student_ID = 39。 amp。 Trim() amp。 39。 End If End If If Check1(1).Value Then If Trim() = Then sMeg = 姓名不能為空 MsgBox sMeg, vbOKOnly + vbExclamation, 警告 Exit Sub Else dd(1) = True If dd(0) Then txtSQL = txtSQL amp。 and student_Name = 39。 amp。 amp。 39。 Else txtSQL = txtSQL amp。 student_Name = 39。 amp。 amp。 39。 End If End If End If 25 If Check1(2).Value Then If Trim() = Then sMeg = 班號不能為空 MsgBox sMeg, vbOKOnly + vbExclamation, 警告 Exit Sub Else dd(2) = True If dd(0) Or dd(1) Then txtSQL = txtSQL amp。 and class_No = 39。 amp。 amp。 39。 Else txtSQL = txtSQL amp。 class_No = 39。 amp。 amp。 39。 End If End If End If If Not (dd(0) Or dd(1) Or dd(2) Or dd(3)) Then MsgBox 請設(shè)置查詢方式! , vbOKOnly + vbExclamation, 警告 Exit Sub End If txtSQL = txtSQL amp。 order by student_ID Set mrc = ExecuteSQL(txtSQL, MsgText) With myflexgrid .Rows = 2 .CellAlignment = 4 .TextMatrix(1, 0) = 學號 .TextMatrix(1, 1) = 姓名 .TextMatrix(1, 2) = 性別 .TextMatrix(1, 3) = 出生日期 26 .TextMatrix(1, 4) = 班號 .TextMatrix(1, 5) = 聯(lián)系電話 .TextMatrix(1, 6) = 入校日期 .TextMatrix(1, 7) = 家庭住址 Do While Not .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows 1, 0) = (0) .TextMatrix(.Rows 1, 1) = (1) .TextMatrix(.Rows 1, 2) = (2) .TextMatrix(.Rows 1, 3) = Format((3), yyyymmdd) .TextMatrix(.Rows 1, 4) = (4) .TextMatrix(.Rows 1, 5) = (5) .TextMatrix(.Rows 1, 6) = Format((6), yyyymmdd) .TextMatrix(.Rows 1, 7) = (7) Loop End With End Sub Private Sub Form_Load() With myflexgrid .CellAlignment = 4 .TextMatrix(1, 0) = 學號 .TextMatrix(1, 1) = 姓名 .TextMatrix(1, 2) = 性別 27 .TextMatrix(1, 3) = 出生日期 .TextMatrix(1, 4) = 班號 .TextMatrix(1, 5) = 聯(lián)系電話 .TextMatrix(1, 6) = 入校日期 .TextMatrix(1, 7) = 家庭住址 End With End Sub 因為 本系統(tǒng)中很多功能模塊具有相似之處,因此在這里 只用 學生學籍管理 模塊進行一個簡單的說明。其 它模塊的代碼就不再贅述 。 6 實例演示 下面執(zhí)行一下這個系統(tǒng)來看看實際的效果。運行程序就會出現(xiàn) 圖 42 所示的系統(tǒng)登錄 界面。 輸入正確的用戶名和密碼后就會出現(xiàn)如圖 43 所示的系統(tǒng)主界面。 在這個界面上單擊“系統(tǒng)”選擇“添加用戶”會出現(xiàn)如圖 51 所示的添加新用戶的界面圖,輸入要添加的用戶名和密碼后單擊“確認”即可向系統(tǒng)中添加一個新用戶。 在學生管理信息系統(tǒng)界面上單擊“班級管理”選擇“添加班級信息”會出現(xiàn)如圖 61 所示的界面,這時可以向系統(tǒng)中添加一個新的班級。 圖 61 添加班級信息界面圖 在學生管理信息系統(tǒng)界面上單擊“班級管理” 選擇“修改班級信息”會出現(xiàn)如圖 62 所示的界面,這時就可以修改系統(tǒng)中任何一個班級的信息了。 28 圖 62 修改班級信息界面圖 本系統(tǒng)的其他模塊的功能也都能一一實現(xiàn),由于操作步驟類似,在這里就不再贅述了。 參考文獻 [1] 陳艷峰,高文姬,邵蘊秋等編著 .Visual Basic 數(shù)據(jù)庫項目案例導航 [M].北京:清華大學出版社, 20xx: 192237, 167168 [2] 鄭阿奇,曹 . Visual Basic 實用教程(第 2 版) [M].北京:電子工業(yè)出版社,20xx( 7) [3] 明日科技,安劍,孫 秀梅 . Visual Basic 數(shù)據(jù)庫系統(tǒng)開發(fā)自學手冊 [M].北京:人民郵電出版社, 20xx [4] 王要武 .管理信息系統(tǒng) [M].北京:電子工業(yè)出版社, 20xx [5] 鄭小玲 .Access 20xx 中文版實用教程 [M].北京:清華大學出版社 ,20xx [6] 黃明,梁旭 . Visual Basic 信息系統(tǒng)設(shè)計與開發(fā)實例 (第 2版) [M].北京: 機械工業(yè)出版社, 20xx( 2), 111