vb和SQL做的学生成绩管理系统(优秀)由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“sqlvb教室管理系统”。
Form1的代码:
Private Sub Command1_Click()Unload Me Form3.Show End Sub
Private Sub Command2_Click()Unload Me Form2.Show End Sub
Private Sub Command3_Click()If MsgBox(“确定退出管理系统?”, _
vbQuestion + vbYesNo + vbDefaultButton2, “警告!”)= vbYes Then End End If End Sub
Private Sub Picture1_Click()
End Sub
Private Sub Timer1_Timer()Command4.Caption = Time$()
End Sub Private Sub Form_Load()Timer1.Interval = 1000 Timer1.Enabled = True
End Sub
Form2的代码:
Private Sub Command1_Click()Adodc1.Recordset.MoveFirst Adodc1.Recordset.Find “用户名='” & Text1.Text & “'” If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveFirst
If((Trim(Text1.Text))=(Trim(Text3.Text)))And((Trim(Text2.Text))=(Trim(Text4.Text)))Then
Adodc1.Enabled = False
Form4.Text3.Text = Text1.Text
Unload Me
Form8.Show
Else
MsgBox “非法的账号!”, vbOKOnly + vbExclamation, “请重新输入!”
Text1.Text = “”
Text2.Text = “”
Text1.SetFocus
End If End Sub
Private Sub Command2_Click()Text1.Text = “” Text2.Text = “” End Sub
Private Sub Command3_Click()Unload Me Form1.Show End Sub Private Sub Form_Load()
Text2.Text = “” Text1.Text = “” Text2.PawordChar = “*”
End Sub
Private Sub Picture1_Click()
End Sub
Form3的代码:
Private Sub Command1_Click()Adodc1.Recordset.MoveFirst Adodc1.Recordset.Find “用户名='” & Text1.Text & “'” If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveFirst
If((Trim(Text1.Text))=(Trim(Text3.Text)))And((Trim(Text2.Text))=(Trim(Text4.Text)))Then
Adodc1.Enabled = False
Form4.Text1.Text = Text1.Text
Form4.Text2.Text = Text4.Text
Unload Me
Form5.Show
Else
MsgBox “非法的账号!”, vbOKOnly + vbExclamation, “请重新输入!”
Text1.Text = “”
Text2.Text = “”
Text1.SetFocus
End If End Sub
Private Sub Command2_Click()Option1.Value = False
Option2.Value = False
Text1.Text = “”
Text2.Text = “” End Sub
Private Sub Command3_Click()Unload Me Form1.Show End Sub
Private Sub Form_Load()Text2.Text = “” Text1.Text = “” Text2.PawordChar = “*”
End Sub
无代码
Form5的代码:
Private Sub cjcx_Click(Index As Integer)Unload Me Form7.Show End Sub
Private Sub Command1_Click()On Error Resume Next
If Command1.Caption = “修改” Then
Command1.Caption = “确认”
Adodc2.Recordset.Requery
Text5.SetFocus Else
Command1.Caption = “修改”
Adodc2.Recordset.Update
MsgBox “修改成功” End If
End Sub
Private Sub Form_Load()Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = “Select * From studentwel Where 用户名 ='” & Form4.Text1.Text & “'” Adodc1.Refresh
Text1.Visible = True
Text3.Visible = True Timer1.Interval = 1000 Timer1.Enabled = True
End Sub
Private Sub Picture1_Click()
End Sub
Private Sub tcxt_Click(Index As Integer)Unload Me Form3.Show End Sub
Private Sub Timer1_Timer()Text2.Text = Time$()
End Sub
Private Sub xgmm_Click()Label5.Visible = True Label7.Visible = True Text4.Visible = True Text5.Visible = True Command1.Visible = True Adodc2.CommandType = adCmdUnknown Adodc2.RecordSource = “Select * From studententer Where 用户名 ='” & Form4.Text1.Text & “'” Adodc2.Refresh
End Sub
Private Sub xxcx_Click(Index As Integer)Unload Me Form6.Show End Sub
Form6的代码:
Private Sub Command1_Click()Unload Me Form5.Show End Sub
Private Sub Command2_Click()
On Error Resume Next
If Command2.Caption = “修改” Then Text1.SetFocus
Command2.Caption = “确认”
Adodc1.Recordset.Requery
MsgBox “信息修改成功” Else
Command2.Caption = “修改”
Adodc1.Recordset.Update
End If
End Sub
Private Sub Form_Load()Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = “Select * From studentinfor Where 学号 ='” & Form4.Text1.Text & “'” Adodc1.Refresh
Text1.Visible = True Text2.Visible = True Text3.Visible = True Text4.Visible = True Text5.Visible = True Text6.Visible = True Text7.Visible = True Text8.Visible = True End Sub
Private Sub Picture1_Click()
End Sub
Private Sub Command1_Click()Unload Me Form5.Show End Sub
Private Sub Form_Load()Adodc1.Recordset.MoveFirst
Dim a As String
a = Form4.Text1.Text
Adodc1.Recordset.Find “学号='” & a & “'”
Text1.Visible = True
Text2.Visible = True Text4.Visible = True Text6.Visible = True Dim b As Integer b = Text2.Text If b >= 90 Then Text3.Text = “优” ElseIf b >= 80 Then Text3.Text = “良” ElseIf b >= 70 Then Text3.Text = “中” ElseIf b >= 60 Then Text3.Text = “及格” Else Text3.Text = “不及格” End If Dim c As Integer c = Text4.Text If c >= 90 Then Text5.Text = “优” ElseIf c >= 80 Then Text5.Text = “良” ElseIf c >= 70 Then Text5.Text = “中” ElseIf c >= 60 Then Text5.Text = “及格” Else Text5.Text = “不及格” End If Dim d As Integer d = Text6.Text If d >= 90 Then Text7.Text = “优” ElseIf d >= 80 Then Text7.Text = “良” ElseIf d >= 70 Then Text7.Text = “中” ElseIf d >= 60 Then Text7.Text = “及格” Else Text7.Text = “不及格” End If If Text3.Text = “不及格” Then Text2.ForeColor = &HFF&
End If If Text5.Text = “不及格” Then Text4.ForeColor = &HFF&
End If If Text7.Text = “不及格” Then Text6.ForeColor = &HFF& End If End Sub
Private Sub Picture1_Click()
End Sub Form8的代码:
Private Sub Command1_Click()On Error Resume Next
If Command1.Caption = “修改” Then
Command1.Caption = “确认”
Adodc1.Recordset.Requery
Text2.SetFocus Else
Command1.Caption = “修改”
Adodc1.Recordset.Update
MsgBox “修改成功” End If
End Sub
Private Sub file1_Click()Unload Me Form10.Show End Sub
Private Sub file2_Click()Unload Me Form9.Show End Sub
Private Sub file4_Click()Unload Me Form12.Show End Sub
Private Sub file5_Click()Unload Me Form11.Show End Sub
Private Sub file7_Click()Unload Me Form2.Show End Sub
Private Sub file8_Click()Label3.Visible = True Label4.Visible = True Text1.Visible = True Text2.Visible = True Command1.Visible = True Adodc1.CommandType = adCmdUnknown Adodc1.RecordSource = “Select * From teacherenter Where 用户名 ='” & Form4.Text3.Text & “'”
Adodc1.Refresh End Sub
Private Sub Picture1_Click()
End Sub
Form9的代码:
Private Sub Command1_Click()Dim mno As String
mno = InputBox(“请输入学号”, “查找窗”)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find “学号='” & mno & “'”
If Adodc1.Recordset.EOF = True Then MsgBox “无此学号!”, , “提示” End Sub
Private Sub Command2_Click()Unload Me Form8.Show End Sub
Private Sub Command3_Click()Dim mnon As String
mnon = InputBox(“请输入姓名”, “查找窗”)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find “姓名='” & mnon & “'”
If Adodc1.Recordset.EOF = True Then MsgBox “无此学号!”, , “提示” End Sub
Private Sub Label5_Click()
End Sub
Private Sub Label7_Click()
End Sub
Form10的代码: Private Sub Command1_Click()On Error Resume Next Command2.Enabled = Not Command2.Enabled Command3.Enabled = Not Command3.Enabled Command4.Enabled = Not Command4.Enabled
If Command1.Caption = “新增” Then
Command1.Caption = “确认”
Adodc1.Recordset.AddNew
Text1.SetFocus Else
Command1.Caption = “新增”
Adodc1.Recordset.Update
Adodc1.Recordset.MoveLast End If
End Sub
Private Sub Command2_Click()On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub Command3_Click()On Error Resume Next
Command1.Enabled = Not Command1.Enabled
Command2.Enabled = Not Command2.Enabled
Command4.Enabled = Not Command4.Enabled
If Command3.Caption = “修改” Then
Command3.Caption = “确认”
Adodc1.Recordset.Requery
Text1.SetFocus Else
Command3.Caption = “修改”
Adodc1.Recordset.Update End If
End Sub
Private Sub Command4_Click()On Error Resume Next
Command1.Caption = “新增”
Command3.Caption = “修改”
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Adodc1.Recordset.CancelUpdate
Adodc1.Recordset.MoveLast
End Sub
Private Sub Command5_Click()Unload Me Form8.Show End Sub
Private Sub Command6_Click()Adodc1.Recordset.MovePrevious If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End If End Sub
Private Sub Command7_Click()Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If End Sub
Private Sub Command8_Click()Adodc1.Recordset.MoveFirst End Sub
Private Sub Command9_Click()Adodc1.Recordset.MoveLast End Sub
Private Sub Label5_Click()
End Sub
Form11的代码:
Private Sub Command1_Click()Dim mno As String
mno = InputBox(“请输入学号”, “查找窗”)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find “学号='” & mno & “'”
If Adodc1.Recordset.EOF = True Then MsgBox “无此学号!”, , “提示” End Sub
Private Sub Command2_Click()Unload Me Form8.Show End Sub
Private Sub Picture1_Click()
End Sub
Form12的代码:
Private Sub Command1_Click()On Error Resume Next Command2.Enabled = Not Command2.Enabled Command3.Enabled = Not Command3.Enabled Command4.Enabled = Not Command4.Enabled
If Command1.Caption = “新增” Then
Command1.Caption = “确认”
Adodc1.Recordset.AddNew
Text1.SetFocus Else
Command1.Caption = “新增”
Adodc1.Recordset.Update
Adodc1.Recordset.MoveLast End If End Sub
Private Sub Command2_Click()On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If End Sub
Private Sub Command3_Click()On Error Resume Next
Command1.Enabled = Not Command1.Enabled
Command2.Enabled = Not Command2.Enabled
Command4.Enabled = Not Command4.Enabled
If Command3.Caption = “修改” Then
Command3.Caption = “确认”
Adodc1.Recordset.Requery
Text1.SetFocus Else
Command3.Caption = “修改”
Adodc1.Recordset.Update End If End Sub
Private Sub Command4_Click()On Error Resume Next
Command1.Caption = “新增”
Command3.Caption = “修改”
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Adodc1.Recordset.CancelUpdate
Adodc1.Recordset.MoveLast End Sub
Private Sub Command5_Click()Unload Me Form8.Show End Sub
Private Sub Command6_Click()Adodc1.Recordset.MovePrevious If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End If End Sub
Private Sub Command7_Click()Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If End Sub
Private Sub Command8_Click()Adodc1.Recordset.MoveFirst End Sub
Private Sub Command9_Click()Adodc1.Recordset.MoveLast End Sub
Private Sub Picture1_Click()
End Sub
数据库部分:
建立数据库表:
目 录摘要……………………………………………………………………………………….2 第一章 引言 ...........................................................3 第二章 系......
登陆登陆Private Sub cmdLogin_Click() If txtUser.Text = "" ThenMsgBox ("请输入用户名!")txtUser.SetFocus Else Call openconn sql = "select * from login wher......
河北联合大学《软件设计基础-VB》课程设计任务书学院班级设计人成绩一、题目:学生成绩管理系统二、目的与要求:1.目的:培养学生综合利用VisualBasic6.0语言进行程序设计的能力,......
VB程序设计 课程设计报告 班 级:***** 姓 名:***** 序 号:***** 指导老师:*****目录 1、课设的目的 .............................................................................
VB程序设计 课程设计报告 班 级:资工10902 班 姓 名:何睦 序 号:05 指导老师:刘少华 邵燕林 王庆陈君华 朱小龙目录1、课设的目的 .................................................