【正文】
) = Trim() (院系編號 ) = Trim() (院系電話 ) = Trim() (院系負責人 ) = Trim() (院系專業(yè) ) = Trim() = = = = = Set rs = Nothing End Sub Private Sub Command2_Click() = = = = = End Sub 35 Private Sub Command3_Click() Unload Me End Sub 修改院系信息代碼如下: Option Explicit Dim conn As New Dim rs As New Dim As New 39。記下當前記錄位置 39。記下當前記錄位置 myBookmark = str2$ = MsgBox(是否刪除當前記錄? , vbOKCancel, 刪除當前記錄!) If str2$ = vbOK Then If Then myBookmark = = myBookmark 39。調用函數顯示數據 Call viewData End If Else = myBookmark Call viewData End If End Sub Private Sub Form_Load() Dim txtSQL As String Dim MsgText As String txtSQL = select * from 院系信息表 Set rs = ExecuteSQL(txtSQL, MsgText) While = False (院系名稱 ) (院系編號 ) (院系專業(yè) ) Wend txtSQL = select * from 院系信息表 Set rs = ExecuteSQL(txtSQL, MsgText) If = False Then Call viewData myBookmark = Else MsgBox 沒有記錄! , vbOKOnly + vbExclamation, 警告 Exit Sub End If End Sub Private Sub Form_Unload(Cancel As Integer) End Sub Public Sub viewData() = rs!院系名稱 38 = rs!院系編號 = rs!院系專業(yè) = rs!院系電話 = rs!院系負責人 End Sub 查詢院系信息代碼如下: Private Sub Command1_Click() Dim txtSQL As String Dim MsgText As String Dim dd(3) As Boolean Dim mrc As txtSQL = select * from 院系信息表 where If Then If Trim() = Then sMeg = 院系名稱不能為空 MsgBox sMeg, vbOKOnly + vbExclamation, 警告 Exit Sub Else dd(0) = True If dd(1) Then txtSQL = txtSQL amp。 39。 amp。 Trim() 39。 order by 院系名稱 Set mrc = ExecuteSQL(txtSQL, MsgText) With MSFlexGrid1 .Rows = 2 .CellAlignment = 1 .TextMatrix(1, 0) = 編號 .TextMatrix(1, 1) = 院系名稱 .TextMatrix(1, 2) = 院系負責人 .TextMatrix(1, 3) = 院系編號 .TextMatrix(1, 4) = 院系專業(yè) .TextMatrix(1, 5) = 院系電話 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) = (3) .TextMatrix(.Rows 1, 4) = (4) .TextMatrix(.Rows 1, 5) = (5) Loop End With End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() With MSFlexGrid1 .CellAlignment = 4 .TextMatrix(1, 0) = 編號 40 .TextMatrix(1, 1) = 院系名稱 .TextMatrix(1, 2) = 院系負責人 .TextMatrix(1, 3) = 院系編號 .TextMatrix(1, 4) = 院系專業(yè) .TextMatrix(1, 5) = 院系電話 End With End Sub 設置年級課程信息代碼如下: Private Sub Combo1_Change() Dim mrc As Dim txtSQL As String Dim MsgText As String Dim i As Integer 39。 39。 amp。查詢數據 txtSQL = select * form 課程信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While ( = False) (1) Wend flagset = True End Sub Private Sub Command4_Click() Dim i As Integer Dim mrc As Dim mrcc As Dim txtSQL As String Dim MsgText As String Dim myBookmark As Variant If Not Testtxt() Then MsgBox 請先選擇院系名稱! , vbOKOnly + vbExclamation, 警告 Exit Sub End If If Not Testtxt() Then MsgBox 請先選擇年級 ! , vbOKOnly + vbExclamation, 警告 Exit Sub End If If Not Testtxt((0)) Then MsgBox 請先選擇課程 ! , vbOKOnly + vbExclamation, 警告 Exit Sub End If For i = 1 To txtSQL = select * from 年 級 課 程 設 置 表 where 年級=39。and 39。Set mrc = ExecuteSQL(txtSQL, MsgText) If = True And = True Then (院系名稱 ) = Trim() (年級 ) = Trim() (課程名稱 ) = Trim((i 1)) End If 42 Next i = = End Sub Private Sub Command5_Click() Unload Me End Sub Private Sub Form_Load() Dim mrc As Dim txtSQL As String Dim MsgText As String txtSQL = select * from 班級信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While = False (年級 ) Wend txtSQL = select * from 院系信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While = False (院系名稱 ) Wend txtSQL = select * from 課程信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While = False (課程名稱 ) Wend End Sub Private Sub List1_Click() If 1 Then = 1 End If End Sub Private Sub List2_Click() If 1 Then = 1 End If End Sub