1、 and password= Trim(txtPwd.Text) & rs.Open sql, conn, adOpenDynamic, adLockOptimistic If rs.EOF Then MsgBox 用户不存在! Else Unload Me frmMain.Show End IfEnd IfEnd Sub退出Private Sub cmdRegister_Click()Unload Me功能选择选课管理Private Sub cmdChoice_Click()frmChoice.ShowPrivate Sub cmdExit_Click()End查询Private Sub c
2、mdFind_Click()frmFind.Show成绩管理Private Sub cmdGrade_Click()frmGrade.Show学生管理Private Sub cmdStu_Click()frmStu.Show添加Private Sub cmdAdd_Click()frmAddStu.Show删除Private Sub cmdDel_Click()rs.DeleteMsgBox (删除成功!编辑Private Sub cmdEdit_Click()frmEditStu.Show查找Private Sub cmdFind_Click() 查询功能If cboFind.Text =
3、学号 If txtInput.Text = MsgBox (学号输入不能为空! txtInput.SetFocus Else Dim sql1 As String Set rs1 = New ADODB.Recordset sql1 = select * from stuInfo where ID= txtInput.Text & rs1.CursorLocation = adUseClient rs1.Open sql1, conn, adOpenDynamic, adLockOptimistic, adCmdText If rs.EOF Then MsgBox (查不到相关信息 txtIn
4、put.SetFocus Else Set DataGrid1.DataSource = rs1 DataGrid1.Refresh End If End If If txtInput.Text = 姓名输入不能为空! Dim sql2 As String Set rs2 = New ADODB.Recordset sql2 = select * from stuInfo where name= rs2.CursorLocation = adUseClient rs2.Open sql2, conn, adOpenDynamic, adLockOptimistic, adCmdText Set
5、 DataGrid1.DataSource = rs2返回Private Sub cmdReturn_Click()frmMain.Show输出窗口Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer) txtInput.Text = DataGrid1.Columns.Item(4) 获取选中行的第5列数据窗体Private Sub Form_Load() Dim sql As String Set conn = New ADODB.Connection Set rs = New ADO
6、DB.Recordset Call openconn sql = select * from stuInfo rs.CursorLocation = adUseClient rs.Open sql, conn, adOpenDynamic, adLockOptimistic, adCmdText Set DataGrid1.DataSource = rs datagrid绑定数据源成绩查询确定Private Sub Command1_Click() lblGrade.Caption = Trim(cboCourse.Text) + 课程成绩 Dim sql1 As String Set rs1
7、 = New ADODB.Recordset sql1 = select score.ID,score.Num,score.score from score, course where name= cboCourse.Text & and score.Num=course.Num sql1 = select * from course rs1.CursorLocation = adUseClient rs1.Open sql1, conn, adOpenDynamic, adLockOptimistic, adCmdText Set DataGrid1.DataSource = rs1 rs.
8、Open sql, conn, adOpenDynamic, adLockOptimistic Do Until rs.EOF cboCourse.AddItem rs(name rs.MoveNext Loop提交Private Sub cmdSubmit_Click()If txtID = MsgBox (请输入学号! txtID.SetFocusElseIf lstCourse.Text = 请选择课程! Dim sql2, name As String Set rs2 = New ADODB.Recordsetselect score.ID, score.Num from score
9、, course where ID= txtID.Text & and name= lstCourse.Text & name = lstCourse.Text sql2 = select Num from course where name= name & rs1.Open sql1, conn, adOpenDynamic, adLockOptimistic rs2.Open sql2, conn, adOpenDynamic, adLockOptimistic If rs1.EOF Then rs1.AddNew rs1(ID) = txtID.TextNum) = rs2( rs1.Update选课成功! rs1.Close已选过该课! Do Until rs.EOF listbox控件利用循环读取课程表中的课程名
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1