数据库原理课程设计-学分管理系统.doc_第1页
数据库原理课程设计-学分管理系统.doc_第2页
数据库原理课程设计-学分管理系统.doc_第3页
数据库原理课程设计-学分管理系统.doc_第4页
数据库原理课程设计-学分管理系统.doc_第5页
已阅读5页,还剩19页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

此文档收集于网络,如有侵权,请联系网站删除 目录1题目要求32程序截图43程序代码104课程设计心得26题目要求:设计一个学分管理系统。假设每位学生必须完成基础课50学分,专业课50学分,选修课24学分,人文类课程8学分和实验性课程20学分才能毕业。实现下列功能:1 录入某位学生的学分信息2 给定学号,显示某位学生的学分完成情况;3 给定班号,显示该班所有学生的学分完成情况;4 给定学号,修改该学生的学分信息;5 按照某类课程的学分高低进行排序;给定学号,对该学生能否毕业进行确定。登陆界面如下:主界面如下:进行插入操作:按班号显示操作:查询结果界面如下:进行按学号进行查询的界面:查询结果如下:排序界面:查询学生是否能够毕业:删除操作:代码如下:Module1:Public cn As New ADODB.ConnectionPublic rs As New ADODB.RecordsetForm1:Public rs As ADODB.RecordsetSub disp() Set DataGrid1.DataSource = rsFor i = 0 To rs.Fields.Count - 1 Text1(i).Text = rs.Fields(i).ValueNextEnd SubSub renew() rs.Close cn.Close Set rs = New ADODB.Recordset Set DataGrid1.DataSource = rs cn.Open dsn=123;uid=sa;pwd= rs.Open select * from credit, cn, adOpenStatic, adLockOptimistic dispEnd SubPrivate Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)End SubPrivate Sub Command1_Click()For i = 0 To 7 Text1(i).Text = Next Text1(0).SetFocusText1(1).Enabled = TrueText1(2).Enabled = TrueCommand11.Enabled = TrueEnd SubPrivate Sub Command10_Click()rs.MovePreviousIf rs.BOF Then msg = MsgBox(已达到第一条, 48 + 0, 提示)rs.MoveFirst End Ifdisp End SubPrivate Sub Command11_Click()Text1(1).Enabled = TrueText1(2).Enabled = Trueinsert_str = insert into credit values( & Text1(0).Text & , & Text1(1).Text & , & Text1(2).Text & , & Text1(3).Text & , & Text1(4).Text & , & Text1(5).Text & , & Text1(6).Text & , & Text1(7).Text & )If Text1(0).Text rs.Fields(0) Thencn.Execute (insert_str) MsgBox 插入成功ElseMsgBox 重复输入数据End IfdisprenewEnd SubPrivate Sub Command12_Click()renewEnd SubPrivate Sub Command13_Click()update_str = update credit set basic= & Text1(3).Text & ,major= & Text1(4).Text & ,soption= & Text1(5).Text & ,speople= & Text1(6).Text & ,sexperiment= & Text1(7).Text & where sno= & Text1(0).Text & If Text1(0).Text rs.Fields(0) Thencn.Execute (update_str)ElseMsgBox 无此内容End IfrenewEnd SubPrivate Sub Command14_Click()sno1 = InputBox(请输入要删除学生的学号:, 查询, 200, 100)delete_str = delete from credit where sno= & sno1If sno1 ThenIf rs.RecordCount = 0 ThenMsgBox 输入学号不正确Elsecn.Execute (delete_str)disprenewEnd IfElseMsgBox errorEnd IfEnd SubPrivate Sub Command15_Click()frmLogin.ShowEnd SubPrivate Sub Command2_Click()Form2.ShowEnd SubPrivate Sub Command3_Click()Form3.ShowEnd SubPrivate Sub Command4_Click()Text1(0).SetFocusFor i = 0 To 7 Text1(i).Text = NextText1(1).Enabled = FalseText1(2).Enabled = FalsedispEnd SubPrivate Sub Command5_Click()Form4.ShowEnd SubPrivate Sub Command6_Click()Dim a(4) As Integersno1 = InputBox(请输入学生的学号:, 查询, 200, 100)Set rs = New ADODB.Recordsetrs.Open select * from credit where sno= & sno1 & , cn, adOpenStatic, adLockOptimisticIf rs.RecordCount = 0 ThenMsgBox 输入学号不正确Elsei = 0For j = 3 To rs.Fields.Count - 1 a(i) = Val(rs.Fields(j).Value) i = i + 1NextIf a(0) = 50 And a(1) = 50 And a(2) = 24 And a(3) = 8 And a(4) = 20 Then MsgBox 该学生已修满学分,可以毕业Else MsgBox 该学生由于未修满学分,不能毕业End IfEnd IfEnd SubPrivate Sub Command7_Click()rs.MoveFirstdispEnd SubPrivate Sub Command8_Click()rs.MoveLastdispEnd SubPrivate Sub Command9_Click()rs.MoveNextIf rs.EOF Then msg = MsgBox(已达到最后一条, 48 + 0, 提示) rs.MoveLastEnd IfdispEnd SubPrivate Sub Form_Load()Set rs = New ADODB.RecordsetSet cn = New ADODB.Connectioncn.Open dsn=123;uid=sa;pwd=rs.Open select * from credit, cn, adOpenStatic, adLockOptimisticdispCommand11.Enabled = FalseForm1.Visible = FalseEnd SubForm2:Private Sub Command1_Click()Form1.ShowForm2.HideEnd SubPrivate Sub Form_Load()classno = InputBox(请输入学生的班号, 查询, 200, 100) rs.Close cn.CloseSet rs1 = New ADODB.RecordsetSet cn = New ADODB.ConnectionSet rs = New ADODB.Recordsetcn.Open dsn=123;uid=sa;pwd=rs.Open select * from credit where sclass= & classno & , cn, adOpenStatic, adLockOptimisticIf rs.RecordCount 0 ThenSet DataGrid2.DataSource = rsElseMsgBox 无此记录!End IfEnd SubForm3:Private Sub Command1_Click()Form1.ShowForm3.HideEnd SubPrivate Sub Form_Load()sno = InputBox(请输入学生的学号, 查询, 200, 100)Set cn = New ADODB.ConnectionSet rs = New ADODB.Recordsetcn.Open dsn=123;uid=sa;pwd=rs.Open select * from credit where sno= & sno & , cn, adOpenStatic, adLockOptimisticIf rs.RecordCount 0 ThenSet DataGrid3.DataSource = rsElseMsgBox 无此记录!End IfEnd SubForm4:Private Sub Command1_Click()Form1.ShowForm4.HideEnd SubPrivate Sub Option1_Click()subject = InputBox(请输入课程名:, 查询, 200, 100)Set cn = New ADODB.ConnectionSet rs = New ADODB.Recordsetcn.Open dsn=123;uid=sa;pwd=If subject = basic Or subject = major Or subject = soption Or subject = speople Or subject = sexperiment Thenrs.Open select * from credit order by & subject, cn, adOpenStatic, adLockOptimisticSet DataGrid4.DataSource = rsElsemsg = MsgBox(error, 48 + 0, 提示)End IfEnd SubPrivate Sub Option2_Click()subject = InputBox(请输入课程名:, 查询, 200, 100)Set cn = New ADODB.ConnectionSet rs = New ADODB.Recordsetcn.Open dsn=123;uid=sa;pwd=If subject = basic Or subject = major Or subject = soption Or subject = speople Or subject = sexperiment Thenrs.Open select * from credit order by & subject & desc, cn, adOpenStatic, adLockOptimisticSet DataGrid4.DataSource = rsElsemsg = MsgBox(error, 48 + 0, 提示)End IfEnd SubFrmlogin:Dim rsuser As ADODB.RecordsetPublic cn1 As ADODB.ConnectionPublic LoginSucceeded As BooleanPrivate Sub cmdCancel_Click() 设置全局变量为 false 不提示失败的登录 LoginSucceeded = False EndEnd SubPrivate Sub cmdOK_Click() Dim query_str As StringSet rsuser = New ADODB.Recordsetuser_str = select * from userinfo where userid= & txtUserName & and password= & txtPassword & rsuser.Open user_str, cn1, adOpenStatic, adLockOptimistic If rsuser.RecordCount 0 Then If rsuser.Fields(power) = admin Then Form1.Enabled = True Else Form1.Enabled = False End If LoginSucceeded = True Unload frmLogi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论