版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、登陆登陆Private Sub cmdLogin_Click()If txtUser.Text = n, ThenMsgBox (请输入用户名!) txtllser.SetFocusElseCall openconnsql = select * from login where username=H, & Trim(txtUser.Text) & and password= &Trim(txtPwd.Text) & ,m,rs.Open sql, conn, adOpenDynamic, adLockOptimisticIf rs.EOFThenMsgBox M用户不存在! “ElseUnlo
2、ad Me frmMain.ShowEnd IfEnd IfEnd Sub退出Private Sub cmdRegister_Click()Unload MeEnd Sub功能选择选课管理Private Sub cmdChoice_Click()frmChoice.ShowUnload MeEnd Sub退出Private Sub cmdExit_Click()EndEnd Sub查询Private Sub cmdFind_Click() frmFind.Show Unload Me End Sub 成绩管理Private Sub cmdGrade_Click() frmGrade.ShowU
3、nload MeEnd Sub学生管理Private Sub cmdStu_Click() frmStu.ShowUnload MeEnd Sub学生管理添加Private Sub cmdAdd_Click() frmAddStu.ShowUnload MeEnd Sub删除Private Sub cmdDel_Click()rs.DeleteMsgBox C*删除成功F)End Sub编辑Private Sub cmdEdit_Click() frmEditStu.ShowUnload MeEnd Sub查找Private Sub cmdFind_Click()查询功能If cboFind.
4、Text = ”学号 H ThenIf txtlnput.Text = ThenMsgBox (学号输入不能为空!) txtlnput.SetFocusElseDim sql1 As StringSet rs1 = New ADODB.Recordsetsql1 = select * from stulnfo where ID= & txtlnput.Text & rs1 .CursorLocation = adUseClientrsl.Open sql1, corm, adOpenDynamic, adLockOptimistic, adCmdText If rs.EOF Then MsgB
5、ox (查不到相关信息)txtlnput.SetFocusElseSet DataGridl .DataSource = rs1DataGridl .RefreshEnd IfEnd IfIf txtlnput.Text = ” ThenMsgBox (姓名输入不能为空!) txtlnput.SetFocusElseDim sql2 As StringSet rs2 = New ADODB.Recordsetsql2 = select * from stulnfo where name= & txtlnput.Text & rs2.CursorLocation = adUseClient rs
6、2.Open sql2, conn, adOpenDynamic, adLockOptimistic, adCmdText If rs.EOF ThenMsgBox (查不到相关信息”)txtinput.SetFocusElseSet DataGridl .DataSource = rs2 DataGridl .RefreshEnd IfEnd IfEnd IfEnd Sub返回Private Sub cmdReturn_Click()frmMain.ShowUnload MeEnd Sub输出窗口Private Sub DataGridl_RowColChange(LastRow As Va
7、riant, ByVai LastCol As Integer) txtlnput.Text = DataGridl.Columns.Item(4) ” 获取选中行的第 5 列数据End Sub窗体Private Sub Form_Load()Dim sql As StringSet conn = New ADODB.ConnectionSet rs = New ADODB.RecordsetCall opencormsql = select * from stulnfo”rs.CursorLocation = adUseClie ntrs.Open sql, corm, adOpenDyna
8、mic, adLockOptimistic, adCmdText Set DataGridl .DataSource =rs datagrid绑定数据源End Sub成绩查询Private Sub cmdReturn_Click() frmMain.ShowUnload MeEnd Sub确定Private Sub Command1_Click()IblGrade.Caption = Trim(cboCourse.Text) + 课程成绩”返回Dim sql1 As StringSet rs1 = New ADODB.Recordsetname=n, &sql1 = Hselect score
9、D,score.Num,score.score from score, course where cboCourse.Text & H, and score.Num=course.Numnfsql1 = Hselect * from course11rsl.CursorLocatio n = adUseClie ntrsl.Open sql1, conn, adOpenDynamic, adLockOptimistic, adCmdTextSet DataGridl .DataSource = rs1End Sub窗体Private Sub Form_Load()Dim sql As Stri
10、ngSet conn = New ADODB.ConnectionSet rs = New ADODB.RecordsetCall openconnsql = Hselect * from course”rs.Open sql, conn, adOpenDynamic, adLockOptimisticDo Until rs.EOF cboCourse.Addltem rs(name) rs.MoveNextLoopEnd Sub选课管理 返回Private Sub cmdReturn_Click() frmMain.ShowUnload MeEnd Sub提交Private Sub cmdS
11、ubmit_Click()If txt ID = ThenMsgBox (M 请输入学号!!”) txtID.SetFocusElself IstCourse.Text = ThenMsgBox (H请选择课程!!“)Dim sql1 As StringDim sql2, name As StringSet rs2 = New ADODB.RecordsetSet rs1 = New ADODB.Recordsetsql1 = ”select scoreD, score.Num from score , course where ID=H, & txtID.Text & H, and name
12、=,H & IstCourse.Text & and score.Num=course.Numnname = IstCourse.Textsql2 = ,fselect Num from course where name=H, & name & rsl.Open sql1, conn, adOpenDynamic, adLockOptimisticrs2.Open sql2, conn, adOpenDynamic, adLockOptimisticIf rsI.EOFThenrs1 .AddNewrs1 (“ID”)= txtID.Textrs1(nNumn) = rs2(”Num”)rs
13、1. UpdateMsgBox (n选课成功F)rs1.CloseElseMsgBox C*已选过该课!n)End IfEnd IfEnd Sub窗体Private Sub Form_Load()Dim sql As StringSet conn = New ADODB.ConnectionSet rs = New ADODB.Recordsetsql = select * from course”Call opencormrs.Open sql, conn, adOpenDynamic, adLockOptimisticDo Until rs.EOF listbox控件利用循环读取课程表中的
14、课程名IstCourse.Addltem rs(,fnamen)rs.MoveNextLoop End Sub查询确定Private Sub cmdOK_Click()If txt ID = ThenMsgBox (学号不能为空!) txtID.SetFocusDim sql As StringElseDim sum1, sum2 As SingleDim n As IntegerSet conn = New ADODB.ConnectionSet rs = New ADODB.RecordsetCall openconnsql = ”select , score.sc
15、ore , course.credit from score , course where scoreD=”& txtID.Text & Hl and score.Num=course.NumHrs.CursorLocation = adUseClientrs.Open sql, conn, adOpenDynamic, adLockOptimistic, adCmdTextSet DataGridl .DataSource = rssum1 = 0sum2 = 0n = 0Do While Not rs.EOFsum1 = sum1 + Val(rs(HscoreH)sum2 = sum2
16、+ Val(rs(“credit”)n = n + 1rs.MoveNextLoopIblAvg.Caption = Format(sum1 / n, 0.0)IbICredit.Capti on = sum2End IfEnd Sub 返回 Private Sub cmdReturn_Click() frmMain.Show Unload MeEnd Sub修改学生信息返回Private Sub cmdReturn_Click()frmStu.ShowUnload MeEnd Sub提交Private Sub cmdSubmit_Click()If txtID.Text = ,H ThenM
17、sgBox (学号不能为空!) txtID.SetFocusElself txtName.Text = ThenMsgBox (姓名不能为空!) txtName.SetFocusElself txtSex.Text = ThenMsgBox C*学分不能为空! u)txtSex.SetFocusElself txtAge.Text = ThenMsgBox (年龄不能为空!) txtAge.SetFocusDim sql As StringSet conn = New ADODB.ConnectionSet rs = New ADODB.RecordsetCall openconnsql =
18、”select * from stulnfo where ID=m & txtID.Text & HH, rs.Open sql, conn, adOpenDynamic, adLockOptimistic If Not rs.EOF Then 判断学号是否存在rs(nameH) = txtName.Text rs(sexH) = txtSex.Text rs(age) = txtAge.Text rs(pro)= cboPro.Text rs.UpdateMsgBox (* 修改成功! ”)ElseMsgBox C*学号不存在!n)End IfEnd IfEnd Sub窗体Private Sub Form_Load() txt ID = rs(ID) txtName = rs(name) txtSex = rs(” sex) txtAge = rs(age) cboPro.Text = rs(”pro”)End Sub添加学生返回Private Sub cmdReset_Click() frmStu.ShowUnload MeEnd Sub提交Private Sub cmdSubmit_Click()If txtID.Text = ,n, ThenMsgBo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年日语外贸业务员劳动协议
- 2024年电气工程服务协议详细模板
- 2024年创意动画广告制作协议示例
- 2024专业护士聘用协议细则
- 2024年度党组织结对共建协议
- DB11∕T 1721-2020 水生生物调查技术规范
- 2024精制陶瓷购销协议样本
- 二手车销售协议范本(个性化)
- 2024年煤矿作业自卸运输车销售协议
- 2024水利建设施工协议规范文本
- 土木工程结构试验与检测课件
- 倍的认识(刘松)
- C++语言基础知识
- 溃疡性结肠炎的中西结合治疗
- 重大版小学英语四年级上册课件
- 工程施工阶段全过程造价控制与管理工作方案 精品
- DB15T 389-2021内蒙古自治区造林技术规程
- 《是谁毒害了小鲤鱼》(幼儿园课件)
- YY∕T 1838-2022 一次性使用末梢采血器
- 求职个人简历表格【范本模板】
- 《企业财务分析》课程思政教学案例
评论
0/150
提交评论