已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
数据库技术课程设计学生成绩管理系统程序附 录用户登陆窗口代码:Dim username As String, userpass As StringPrivate Sub Command1_Click()Adodc1.Recordset.MoveFirstAdodc1.Recordset.Find (userID= & Text1 & )If Adodc1.Recordset.EOF ThenMsgBox 无此用户,请重新输入!Exit SubElseabc = Adodc1.Recordset.Fields(1)If Text2 = Trim(abc) ThenMsgBox 欢迎使用本系统,点击进入!, vbOKOnly, 登陆Me.HideForm2.ShowElseMsgBox 用户名或密码不正确,请重新输入!Text1 = Text2 = Exit SubEnd IfEnd IfEnd SubPrivate Sub Command2_Click()EndEnd Sub添加记录代码:Private Sub Command1_Click()Adodc1.Recordset.AddNewText1 = InputBox(请输入学生学号, 添加学号)Text2 = InputBox(请输入学生姓名, 添加姓名)Text3 = InputBox(请输入学生性别, 添加性别)Text4 = InputBox(请输入学生年龄, 添加年龄)If Not IsNumeric(Text4) ThenMsgBox 请输入数值Text4.SetFocusEnd IfText5 = InputBox(请输入学生系别, 添加系别)resu = MsgBox(确认添加到数据库, vbOKCancel, 确认添加)If resu = vbOK ThenAdodc1.Recordset.UpdateElseAdodc1.Recordset.DeleteEnd IfEnd SubPrivate Sub Command2_Click()Me.HideForm2.ShowEnd Sub学生查询代码:Private Sub Command1_Click()If Text1 = ThenMsgBox 请输入查询条件Text1.SetFocusEnd IfIf Option1.Value = True ThenAdodc1.Recordset.Find (sno= & Text1 & )If Adodc1.Recordset.EOF Then MsgBox 没有该学生ElseIf Option2.Value = True ThenAdodc1.Recordset.Find (sname= & Text1 & )If Adodc1.Recordset.EOF Then MsgBox 没有该学生End IfEnd SubPrivate Sub Option1_Click()Text2 = Adodc1.Recordset.MoveFirstEnd SubPrivate Sub Option2_Click()Text1 = Adodc1.Recordset.MoveFirstEnd Sub成绩查询代码:Private Sub Command1_Click()If Text4 = ThenMsgBox 请输入查询的学号Text4.SetFocus End IfAdodc1.Recordset.MoveFirstabcd = Sno= & Text4 & Adodc1.Recordset.Find (abcd)If Adodc1.Recordset.EOF ThenMsgBox 没有该学生记录Text4.SetFocusEnd IfEnd SubPrivate Sub Text4_Change()If Len(Text4) 0 ThenCommand1.Enabled = TrueElseCommand1.Enabled = FalseEnd IfEnd Sub修改记录代码:Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)Adodc1.Caption = Adodc1.Recordset.AbsolutePosition & / & Adodc1.Recordset.RecordCountEnd SubPrivate Sub Command1_Click(Index As Integer) Select Case Index Case 0 Adodc1.Recordset.MoveFirst 第一条 Case 1 Adodc1.Recordset.MovePrevious 上一条 If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst Case 2 Adodc1.Recordset.MoveNext 下一条 If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast Case 3 Adodc1.Recordset.MoveLast 最后一条 Case 4 Dim mno As String mno = InputBox(请输入学号, 查找窗) 将输入值存到变量内 Adodc1.Recordset.MoveFirst 移动记录指针到第一条记录上 Adodc1.Recordset.Find (sno= & mno & ) 用.Find方法查找指定科目 If Adodc1.Recordset.EOF Then MsgBox 无此学号! & Adodc1.Recordset.AbsolutePosition, , 提示 End SelectEnd SubPrivate Sub Command2_Click()Adodc1.Recordset.UpdateEnd Sub成绩添加代码:Private Sub Command1_Click()Dim adc As StringAdodc1.Recordset.AddNewa: Text1 = InputBox(输入学生学号, 添加成绩)mm = Len(Text1)For i = 1 To mmabc = Mid(Text1, i, 1)If abc 9 ThenMsgBox 输入格式不正确请重新输入GoTo aEnd IfNext ib: Text2 = InputBox(输入课程号, 添加成绩)mm = Len(Text2)For i = 1 To mmabc = Mid(Text2, i, 1)If abc 9 ThenMsgBox 输入格式不正确请重新输入GoTo bEnd IfNext ic: Text3 = InputBox(输入学生成绩, 添加成绩)mm = Len(Text3)For i = 1 To mmabc = Mid(Text3, i, 1)If abc 9 ThenMsgBox 输入格式不正确请重新输入GoTo aEnd IfNext iresu = MsgBox(确认添加数据库?, vbOKOnly, 确认添加)If resu = vbOK ThenAdodc1.Recordset.UpdateElseText1 = Text2 = Text3 = End IfEnd Sub学生档案管理代码:Private Sub Command1_Click(Index As Integer) Select Case Index Case 0 Adodc1.Recordset.MoveFirst 第一条 Case 1 Adodc1.Recordset.MovePrevious 上一条 If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst Case 2 Adodc1.Recordset.MoveNext 下一条 If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast Case 3 Adodc1.Recordset.MoveLast 最后一条 Case 4 Dim mno As String mno = InputBox(请输入学号, 查找窗) 将输入值存到变量内 Adodc1.Recordset.MoveFirst 移动记录指针到第一条记录上 Adodc1.Recordset.Find (sno= & mno & ) 用.Find方法查找指定科目 If Adodc1.Recordset.EOF Then MsgBox 无此学号! & Adodc1.Recordset.AbsolutePosition, , 提示 End SelectEnd SubPrivate Sub Command2_Click()Dim abcd As StringDim find1a: If Option1.Value = Option2.Value ThenMsgBox 请选择查询条件!Exit SubEnd IfIf Text6.Text = ThenMsgBox 请输入查询条件Text1.SetFocusExit SubEnd IfIf Option1.Value = True ThenAdodc1.Recordset.Find (sno= & Text6 & )If Adodc1.Recordset.EOF Then MsgBox 没有该学生ElseIf Option2.Value = True ThenAdodc1.Recordset.Find (sname= & Text6 & )If Adodc1.Recordset.EOF Then MsgBox 没有该学生End IfEnd SubPrivate Sub Command3_Click()If Option3.Value = True ThenAdodc1.Recordset.UpdateText1.Locked = TrueText2.Locked = TrueText3.Locked = TrueText4.Locked = TrueText5.Locked = TrueElseAdodc1.Recordset.DeleteAdodc1.Recordset.UpdateEnd IfEnd SubPrivate Sub Option1_Click()Text6 = Adodc1.Recordset.MoveFirstEnd SubPrivate Sub Option2_Click()Text6 = Adodc1.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 县级体育馆社会体育指导员飞盘高尔夫工作年度总结
- 大型云项目架构设计能力提升计划中级
- 探秘成功的网络营销背后产品选择的核心因素
- 初级汽车维修技能实训指导书
- 会计工作计划与财务报表编制指南
- 中国石油拉美面试准备博客
- 话务员呼叫中心情绪管理与压力应对好用指南
- 平顶山燃气整改通知书
- 广东工业大学助学班入学通知书
- 广西服预备役通知书
- 第六课-实现人生的价值-课件-高中政治统编版必修四哲学与文化-
- 砂石料场租赁协议
- 第15届全国海洋知识竞赛参考试指导题库(含答案)
- 收养申请书模板
- 干部人才培养与医院管理
- 公共基础知识复习资料梳理版
- 《SEM基础知识培训》课件
- 农村耕地承包权永久转让合同
- 【MOOC】数字逻辑与数字系统设计-中国矿业大学 中国大学慕课MOOC答案
- Unit4 Body Language Using Language 说课稿-2024-2025学年高中英语人教版(2019)选择性必修第一册
- 医疗机构信息系统安全防护预案
评论
0/150
提交评论