第一篇:vb和SQL做的學(xué)生成績管理系統(tǒng)
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(“確定退出管理系統(tǒng)?”, _
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 “非法的賬號(hào)!”, 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.PasswordChar = ”*“
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 ”非法的賬號(hào)!“, 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.PasswordChar = ”*“
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 = ”確認(rèn)“
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 = ”確認(rèn)“
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 學(xué)號(hào) ='“ & 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 ”學(xué)號(hào)='“ & 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 = ”優(yōu)“ 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 = ”優(yōu)“ 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 = ”優(yōu)“ 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 = ”確認(rèn)“
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(”請輸入學(xué)號(hào)“, ”查找窗“)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ”學(xué)號(hào)='“ & mno & ”'“
If Adodc1.Recordset.EOF = True Then MsgBox ”無此學(xué)號(hào)!“, , ”提示“ 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 ”無此學(xué)號(hào)!“, , ”提示“ 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 = ”確認(rèn)“
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 = ”確認(rèn)“
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(”請輸入學(xué)號(hào)“, ”查找窗“)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ”學(xué)號(hào)='“ & mno & ”'“
If Adodc1.Recordset.EOF = True Then MsgBox ”無此學(xué)號(hào)!“, , ”提示“ 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 = ”確認(rèn)“
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 = ”確認(rèn)“
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
數(shù)據(jù)庫部分:
建立數(shù)據(jù)庫表:
第二篇:vb學(xué)生成績管理系統(tǒng)論文
目 錄
摘要……………………………………………………………………………………….2 第一章 引言...........................................................3 第二章 系統(tǒng)設(shè)計(jì)的目的與要求...........................................3 1.1系統(tǒng)設(shè)計(jì)的目的....................................................3 1.2系統(tǒng)設(shè)計(jì)的實(shí)驗(yàn)環(huán)境................................................4 1.3系統(tǒng)設(shè)計(jì)的預(yù)備知識(shí)................................................3 1.4系統(tǒng)設(shè)計(jì)的要求....................................................4
第三章 系統(tǒng)的概述.....................................................3 2.1系統(tǒng)的需求........................................................3 2.2可行性分析........................................................4 第四章 前臺(tái)界面分析...................................................4 3.1 登陸界面..........................................................4 3.2信息查詢..........................................................6 第五章 數(shù)據(jù)庫的分析...................................................6 4.1 YONGHU表...........................................................7 4.2 STUDENT 表.........................................................7 4.3 SCORE表...........................................................7 4.4 COURSE表...........................................................8 第六章 軟件維護(hù).......................................................8 5.1數(shù)據(jù)維護(hù)..........................................................9 5.2代碼維護(hù)..........................................................9 結(jié)語及致謝............................................................9 參考文獻(xiàn)..............................................................9
VB學(xué)生成績管理系統(tǒng)
摘要:隨著科學(xué)技術(shù)在管理上越來越深入而廣泛的應(yīng)用,管理信息系統(tǒng)的技術(shù)已逐步成熟。學(xué)生成績管理系統(tǒng)是一個(gè)不斷發(fā)展的新型學(xué)科,任何一個(gè)學(xué)校要生存要發(fā)展,要高效率地把內(nèi)部活動(dòng)有機(jī)地組織起來,因?yàn)楣芾磉@些龐大的體系是非常困難的,要想有機(jī)地組織起來,就必須建立與自身特點(diǎn)相適應(yīng)的成績管理系統(tǒng)。本文對Visual Basic6.0應(yīng)用程序設(shè)計(jì)等工具進(jìn)行了較深入的學(xué)習(xí)和應(yīng)用,利用其提供的各種面向?qū)ο蟮拈_發(fā)工具,尤其是數(shù)據(jù)窗口這一能方便而簡潔操縱數(shù)據(jù)庫的智能化對象,主要完成了對學(xué)生成績管理系統(tǒng)的系統(tǒng)分析部分,界面的設(shè)計(jì)、數(shù)據(jù)庫的設(shè)計(jì)等;系統(tǒng)設(shè)計(jì)部分主要介紹了系統(tǒng)功能設(shè)計(jì)和數(shù)據(jù)庫設(shè)計(jì)及代碼設(shè)計(jì);
關(guān)鍵詞:visual basic,學(xué)生成績管理系統(tǒng),數(shù)據(jù)庫,查詢
Abstract:Along with science technique is on the management more and more thorough but extensive application, manage information system of technique already gradually mature.Student result management the system is a new academics which develops continuously, the whichever school wants to exist to want a development, high-efficiencily internal activity organically the organization get up, because manage these huge systems are very difficult, think organically the organization get up, have to build up is mutually accommodative with oneself characteristics of result management system.This text to Visual Basic6.0 application program design etc.the tool carried on more thorough study and application, making use of what it provide various development tool which face to object, is the intelligence that data window way's this ability is convenient and simple and direct to manipulate a database to turn object particularly, mainly completed to manage the analysis part of the system of system to student's result, the design, database of interface of design etc.;The system design part mainly introduced design and database design of the system function and code design;Keywords: visual basic,Student result management the system,database, enquiries
第一章 引言
在高科技不斷發(fā)展的今天,計(jì)算機(jī)技術(shù)己經(jīng)廣泛應(yīng)用到社會(huì)的各個(gè)領(lǐng)域。從六十年代中期爆發(fā)了著名的軟件危機(jī)開始,計(jì)算機(jī)界就一直在探索軟件開發(fā)理論和方法,以確保計(jì)算機(jī)技術(shù)能夠高效地應(yīng)用于各領(lǐng)域。隨著計(jì)算機(jī)技術(shù)不斷發(fā)展、完善,如何開發(fā)、應(yīng)用高效率計(jì)算機(jī)軟件、信息系統(tǒng)一直是開發(fā)人員在試圖解決的難題。盡管開發(fā)人員已經(jīng)提供了很多解決的方法,但是現(xiàn)在開發(fā)、應(yīng)用管理信息系統(tǒng)軟件的過程中,仍會(huì)碰到以下的情形。學(xué)生成績管理系統(tǒng)軟件應(yīng)用的好壞直接影響到學(xué)校以及學(xué)校今后發(fā)展。只有確定出簡單、安全、高效的開發(fā)設(shè)計(jì)方法并應(yīng)用于學(xué)生成績管理系統(tǒng)的開發(fā)設(shè)計(jì)中,才能使先進(jìn)的計(jì)算機(jī)工具為個(gè)人發(fā)展提供高效的服務(wù):才能開發(fā)出完整靈活的學(xué)生成績管理系統(tǒng),具有良好的可擴(kuò)充性、適應(yīng)性,系統(tǒng)安全性能高,具有友好的用戶界面并且操作簡便,因此,學(xué)生成績管理系統(tǒng)開發(fā)設(shè)計(jì)方法的應(yīng)用研究具有積極的現(xiàn)實(shí)意義。第二章 系統(tǒng)設(shè)計(jì)的目的與要求 2.1 系統(tǒng)設(shè)計(jì)的目的
本課程設(shè)計(jì)是計(jì)算機(jī)科學(xué)與技術(shù)專業(yè)重要的實(shí)踐性環(huán)節(jié)之一,是在學(xué)生學(xué)習(xí)完《程序設(shè)計(jì)語言(C)》課程后進(jìn)行的一次全面的綜合練習(xí)。本課程設(shè)計(jì)的目的和任務(wù): 2.2 系統(tǒng)設(shè)計(jì)的實(shí)驗(yàn)環(huán)境
硬件要求能運(yùn)行Windows 2000/XP操作系統(tǒng)的微機(jī)系統(tǒng)。C語言程序設(shè)計(jì)及相應(yīng)的開發(fā)環(huán)境。
2.3 系統(tǒng)設(shè)計(jì)的預(yù)備知識(shí)
熟悉C語言及C語言開發(fā)工C語言與Access。
第二章 系統(tǒng)的概述
本學(xué)生成績管理系統(tǒng)可以說是一個(gè)綜合性的學(xué)校學(xué)生成績管理系統(tǒng),這它集成了多種功能,因而具有較強(qiáng)的實(shí)用性和先進(jìn)性。2.1系統(tǒng)的需求
通過調(diào)查,要求系統(tǒng)需要有以下功能: ⑴ 由于操作人員的計(jì)算機(jī)知識(shí)普遍較差,要求有良好的人機(jī)界面;⑵ 由于該系統(tǒng)的使用對象多,要求有較好的權(quán)限管理;⑶ 原始數(shù)據(jù)修改簡單方便,支持多條件修改 ⑷ 方便的數(shù)據(jù)查詢,支持多條件查詢;⑸ 在相應(yīng)的權(quán)限下,刪除數(shù)據(jù)方便簡單,數(shù)據(jù)穩(wěn)定性好; ⑹ 數(shù)據(jù)計(jì)算自動(dòng)完成,盡量減少人工干預(yù);2.2可行性分析
由于本系統(tǒng)管理的對象單一,都是在校學(xué)生,且每個(gè)數(shù)據(jù)內(nèi)容具有較強(qiáng)的關(guān)聯(lián)性,涉及的計(jì)算過程不是很復(fù)雜。因此,比較適合于采用數(shù)據(jù)庫管理。且學(xué)校用于學(xué)生管理的微機(jī)都是PIII以上的機(jī)器,在存儲(chǔ)量、速度方面都能滿足數(shù)據(jù)庫運(yùn)行的要求。在技術(shù)難度方面,由于有指導(dǎo)老師的指導(dǎo)和相關(guān)參考文獻(xiàn),特別是網(wǎng)上資料,特別是參考其它程序的功能,因此完全可以實(shí)現(xiàn)。本系統(tǒng)的設(shè)計(jì)是在Windows XP中文版操作系統(tǒng)環(huán)境下,使用Visual Basic 6.0中文版開發(fā)成功的。第三章 前臺(tái)界面分析 3.1 登陸界面
主要代碼
Option Explicit Dim m As Integer
Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Private rsmc As ADODB.Recordset Public username As String Private Sub cmdOk_Click()Dim ee As String rs.MoveFirst If m < 3 Then If Trim(txtusername.Text)= “" Or pwd.Text = ”“ Then MsgBox ”用戶名或密碼不能為空!請重新輸入!“, vbInformation, ”登錄信息“ Exit Sub End If Do While Not rs.EOF If rs.Fields(0)= txtusername.Text And rs.Fields(1)= pwd.Text Then MsgBox ”歡迎你進(jìn)入學(xué)生成績管理系統(tǒng),“ frmmain.Show Unload Me Exit Sub End If rs.MoveNext Loop m = m + 1 ee = MsgBox(”用戶名或密碼錯(cuò)誤!請重新輸入!“, vbCritical + vbRetryCancel, ”登錄信息“)'重試/取消 txtusername.Text = ”“ If ee = vbNo Then Unload Me Else pwd.Text = ”“ txtusername.SetFocus
End If Else MsgBox ”對不起,您的輸入次數(shù)已達(dá)到最大限度!請退出!“, vbExclamation, ”提示信息“ '提示信息,確定 End End If End Sub Private Sub Form_Load()Set conn = New ADODB.Connection
conn.Provider = ”Microsoft.Jet.OLEDB.4.0“ conn.ConnectionString = ”Data Source=“ & App.Path & ”aa.mdb“ conn.Open Set rs.ActiveConnection = conn With rs.Open(”select * from yonghu“).MoveFirst End With txtusername.Text = rs.Fields(0)Do While Not rs.EOF txtusername.AddItem(rs.Fields(0))rs.MoveNext Loop txtusername.Text = ”" End Sub 3.2信息查詢
信息查詢主要是對學(xué)生的基本信息和學(xué)生的成績進(jìn)行查詢。在查詢的過程你可以利用學(xué)號(hào)、課程號(hào)、專業(yè)名等進(jìn)行查詢。第四章 數(shù)據(jù)庫的分析
4.1 yonghu表
主要是登陸用戶所用的表。
4.2 student 表
學(xué)生的各種信息都來源于這個(gè)表。4.3 score表
此表是記錄學(xué)生成績信息表。4.4 course表
此表是記錄學(xué)生課程的表。第五章 軟件維護(hù)
在軟件運(yùn)行維護(hù)階段對軟件產(chǎn)品所進(jìn)行的修改就是維護(hù)。系統(tǒng)維護(hù)就是為了保證系統(tǒng)中的各個(gè)要素隨著環(huán)境的變化始終處于最新的,正確的工作狀態(tài)。系統(tǒng)維護(hù)的目的是保證管理信息系統(tǒng)正常而可靠地運(yùn)行,并能使系統(tǒng)不斷地得到改善和提高,以充
分發(fā)揮作用。
本系統(tǒng)的維護(hù)是面向系統(tǒng)中各種構(gòu)成要素的,根據(jù)維護(hù)對象的不同,系統(tǒng)維護(hù)的內(nèi)容可分為以下幾類: 5.1數(shù)據(jù)維護(hù)
本系統(tǒng)對數(shù)據(jù)的需求是不斷發(fā)生變化的,系統(tǒng)中查詢題目中數(shù)據(jù)要定期正常更新,或隨環(huán)境及需要的變化而進(jìn)行調(diào)整。此外,數(shù)據(jù)的備份與恢復(fù),都是數(shù)據(jù)維護(hù)的工作內(nèi)容。5.2代碼維護(hù)
隨著系統(tǒng)應(yīng)用范圍的擴(kuò)大,應(yīng)用環(huán)境的變化,系統(tǒng)中的各種代碼都需要進(jìn)行一定程度的增加、修改、刪除,以及設(shè)置新的代碼。結(jié)語及致謝
通過這次的設(shè)計(jì),讓我對VB的使用有了進(jìn)一步的了解。在我做設(shè)計(jì)的過程遇到了許多的困難。通過老師和同學(xué)的幫助, 一一化解了困難,并從中學(xué)到了很多編程方面的知識(shí)。
在本次畢業(yè)設(shè)計(jì)中,我要向我的指導(dǎo)老師致以深深的謝意,感謝指導(dǎo)老師在這段時(shí)間里在學(xué)習(xí)上和生活上所給予的悉心的教誨和無微不至的幫助,在我感覺到自己知識(shí)有所貧乏的時(shí)候給了我細(xì)心的指導(dǎo)和技術(shù)上的支持。使我自身的能力得到了不少的提高,這對于我以后的工作和學(xué)習(xí)都有一種巨大的幫助。感謝指導(dǎo)老師的耐心輔導(dǎo)。
參考文獻(xiàn)
[1] 宗大華,陳吉人.C語言程序設(shè)計(jì)教程.人民郵電出版社,2004-6-1 [2] 韓春成.C語言程序設(shè)計(jì)教程/21世紀(jì)高等院校規(guī)劃教材.中國水利水電出版社,2007,1,14 [3] 寧正元.數(shù)據(jù)結(jié)構(gòu)--用C語言描述.中國水利水電出版社,2005-4-27 [4] 李梅.C語言編程入門.化學(xué)工業(yè)出版社,2002,01,01 [5] 于華,都一兵.優(yōu)化Visual Basic.NET應(yīng)用程序的性能[J].計(jì)算機(jī)系統(tǒng)應(yīng)用,2004,10 [6] 邵英海.Visual Basic數(shù)據(jù)庫開發(fā)技術(shù)的探討.[J].丹東紡專學(xué)報(bào),2004,11,4 [7] 金鳳霞.VB中Paint Picture圖形方法的使用 CAJ原文下載[J]., 1999,04 [8] 譚浩強(qiáng).《C程序設(shè)計(jì)題解與上機(jī)指導(dǎo)(第3版)》.清華大學(xué)出版社,2005,7 [9] 聶雪軍,賀軍/譯.[美]Harvey M.Deitel, Paul J.Deitel /著.《C程序設(shè)計(jì)經(jīng)典教程(第4版)》,清華大學(xué)出版社,2006,3 [10] 李春葆,張植民,肖忠付.《C語言程序設(shè)計(jì)題典》.清華大學(xué)出版社 ,2002,7 [11] 張小潘/譯,[美]科漢/著.《C語言編程(第3版)》.電子工業(yè)出版社 ,2006,3
[12] 徐寶文 李志/譯,[美]Brian W.Kernighan, Dennis M.Ritchie /著.《C程序設(shè)計(jì)語言(第2版·新
版)》.機(jī)械工業(yè)出版社,2004,1 [13] 魯沐浴.《C語言最新編程技巧200例》.電子工業(yè)出版社,1997,1
[14] 梁
翎,李愛齊.《C語言程序設(shè)計(jì)實(shí)用技巧與程序?qū)嵗?上海科普出版社,1996,5 [15] 陳國章.《Turbo C程序設(shè)計(jì)技巧與應(yīng)用實(shí)例》.天津科學(xué)技術(shù)出版社,1995,5 [16] 王士元.《C高級實(shí)用程序設(shè)計(jì)》.清華大學(xué)出版社,1996,6
第三篇:學(xué)生成績管理系統(tǒng)VB程序
登陸
登陸
Private Sub cmdLogin_Click()If txtUser.Text = “" Then
MsgBox(”請輸入用戶名!“)
txtUser.SetFocus Else Call openconn sql = ”select * from login where username='“ & Trim(txtUser.Text)& ”' and password='“ & Trim(txtPwd.Text)& ”'“ rs.Open sql, conn, adOpenDynamic, adLockOptimistic If rs.EOF Then
MsgBox ”用戶不存在!“
Else
Unload Me
frmMain.Show End If End If End Sub
退出
Private Sub cmdRegister_Click()Unload Me End Sub
功能選擇
選課管理
Private Sub cmdChoice_Click()frmChoice.Show Unload Me End Sub 退出
Private Sub cmdExit_Click()End End Sub 查詢
Private Sub cmdFind_Click()frmFind.Show Unload Me End Sub 成績管理
Private Sub cmdGrade_Click()frmGrade.Show Unload Me End Sub 學(xué)生管理
Private Sub cmdStu_Click()frmStu.Show Unload Me End Sub
學(xué)生管理
添加
Private Sub cmdAdd_Click()frmAddStu.Show Unload Me End Sub 刪除
Private Sub cmdDel_Click()rs.Delete MsgBox(”刪除成功!“)End Sub 編輯
Private Sub cmdEdit_Click()frmEditStu.Show Unload Me End Sub 查找
Private Sub cmdFind_Click()'查詢功能 If cboFind.Text = ”學(xué)號(hào)“ Then
If txtInput.Text = ”“ Then
MsgBox(”學(xué)號(hào)輸入不能為空!“)
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(”查不到相關(guān)信息“)
txtInput.SetFocus
Else
Set DataGrid1.DataSource = rs1
DataGrid1.Refresh
End If
End If Else
If txtInput.Text = ”“ Then
MsgBox(”姓名輸入不能為空!“)
txtInput.SetFocus
Else
Dim sql2 As String
Set rs2 = New ADODB.Recordset
sql2 = ”select * from stuInfo where name='“ & txtInput.Text & ”'“
rs2.CursorLocation = adUseClient
rs2.Open sql2, conn, adOpenDynamic, adLockOptimistic, adCmdText
If rs.EOF Then
MsgBox(”查不到相關(guān)信息“)
txtInput.SetFocus
Else
Set DataGrid1.DataSource = rs2
DataGrid1.Refresh
End If
End If End If End Sub 返回
Private Sub cmdReturn_Click()frmMain.Show Unload Me End Sub 輸出窗口
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
' txtInput.Text = DataGrid1.Columns.Item(4)''獲取選中行的第5列數(shù)據(jù)
End Sub 窗體
Private Sub Form_Load()
Dim sql As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Call openconn
sql = ”select * from stuInfo“
rs.CursorLocation = adUseClient
rs.Open sql, conn, adOpenDynamic, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rs 'datagrid綁定數(shù)據(jù)源 End Sub
成績查詢
返回 Private Sub cmdReturn_Click()frmMain.Show Unload Me End Sub 確定
Private Sub Command1_Click()
lblGrade.Caption = Trim(cboCourse.Text)+ ”課程成績“
Dim sql1 As String
Set rs1 = 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 End Sub 窗體
Private Sub Form_Load()
Dim sql As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Call openconn
sql = ”select * from course“
rs.Open sql, conn, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
cboCourse.AddItem rs(”name“)
rs.MoveNext
Loop End Sub
選課管理
返回
Private Sub cmdReturn_Click()frmMain.Show Unload Me End Sub 提交
Private Sub cmdSubmit_Click()If txtID = ”“ Then
MsgBox(”請輸入學(xué)號(hào)!“)
txtID.SetFocus ElseIf lstCourse.Text = ”“ Then
MsgBox(”請選擇課程!“)Else
Dim sql1 As String
Dim sql2, name As String
Set rs2 = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
sql1 = ”select score.ID, score.Num from score , course where ID='“ & txtID.Text & ”' and name='“ & lstCourse.Text & ”' and score.Num=course.Num“
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.Text
rs1(”Num“)= rs2(”Num“)
rs1.Update
MsgBox(”選課成功!“)
rs1.Close
Else
MsgBox(”已選過該課!“)
End If End If End Sub 窗體
Private Sub Form_Load()
Dim sql As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
sql = ”select * from course“
Call openconn
rs.Open sql, conn, adOpenDynamic, adLockOptimistic
Do Until rs.EOF 'listbox控件利用循環(huán)讀取課程表中的課程名
lstCourse.AddItem rs(”name“)
rs.MoveNext
Loop End Sub
查詢
確定
Private Sub cmdOK_Click()If txtID = ”“ Then
MsgBox(”學(xué)號(hào)不能為空!“)
txtID.SetFocus Else
Dim sql As String
Dim sum1, sum2 As Single
Dim n As Integer
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Call openconn
sql = ”select course.name , score.score , course.credit from score , course where score.ID='“ & txtID.Text & ”' and score.Num=course.Num“
rs.CursorLocation = adUseClient
rs.Open sql, conn, adOpenDynamic, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rs
sum1 = 0
sum2 = 0
n = 0
Do While Not rs.EOF
sum1 = sum1 + Val(rs(”score“))
sum2 = sum2 + Val(rs(”credit“))
n = n + 1
rs.MoveNext
Loop
lblAvg.Caption = Format(sum1 / n, ”0.0“)
lblCredit.Caption = sum2 End If End Sub 返回
Private Sub cmdReturn_Click()frmMain.Show Unload Me End Sub
修改學(xué)生信息
返回
Private Sub cmdReturn_Click()frmStu.Show Unload Me End Sub 提交
Private Sub cmdSubmit_Click()If txtID.Text = ”“ Then
MsgBox(”學(xué)號(hào)不能為空!“)
txtID.SetFocus ElseIf txtName.Text = ”“ Then
MsgBox(”姓名不能為空!“)
txtName.SetFocus ElseIf txtSex.Text = ”“ Then
MsgBox(”學(xué)分不能為空!“)
txtSex.SetFocus ElseIf txtAge.Text = ”“ Then
MsgBox(”年齡不能為空!“)
txtAge.SetFocus Else
Dim sql As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Call openconn
sql = ”select * from stuInfo where ID='“ & txtID.Text & ”'“
rs.Open sql, conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
'判斷學(xué)號(hào)是否存在 rs(”name“)= txtName.Text
rs(”sex“)= txtSex.Text
rs(”age“)= txtAge.Text
rs(”pro“)= cboPro.Text
rs.Update
MsgBox(”修改成功!“)
Else
MsgBox(”學(xué)號(hào)不存在!“)
End If End If End Sub 窗體
Private Sub Form_Load()txtID = rs(”ID“)txtName = rs(”name“)txtSex = rs(”sex“)txtAge = rs(”age“)cboPro.Text = rs(”pro“)End Sub
添加學(xué)生
返回
Private Sub cmdReset_Click()frmStu.Show Unload Me End Sub 提交
Private Sub cmdSubmit_Click()If txtID.Text = ”“ Then
MsgBox(”學(xué)號(hào)不能為空!“)
txtID.SetFocus ElseIf txtName.Text = ”“ Then
MsgBox(”請輸入姓名!“)
txtName.SetFocus ElseIf txtSex.Text = ”“ Then
MsgBox(”請輸入性別!“)
txtSex.SetFocus ElseIf txtAge.Text = ”“ Then
MsgBox(”年齡不能為空!“)
txtAge.SetFocus Else
Dim sql As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Call openconn
sql = ”select * from stuInfo where ID='“ & txtID.Text & ”'“
rs.Open sql, conn, adOpenDynamic, adLockOptimistic
If rs.EOF Then
'判斷學(xué)號(hào)是否存在 rs.AddNew
rs(”ID“)= txtID.Text
rs(”name“)= txtName.Text
rs(”sex“)= txtSex.Text
rs(”age“)= txtAge.Text
rs(”pro“)= cboPro.Text
rs.Update
MsgBox(”添加成功!“)
frmStu.Show
Unload Me
Else
MsgBox(”學(xué)號(hào)已存在!")
End If End If End Sub
第四篇:VB學(xué)生成績管理系統(tǒng)任務(wù)書
河北聯(lián)合大學(xué)
《軟件設(shè)計(jì)基礎(chǔ)-VB》課程設(shè)計(jì)任務(wù)書
學(xué)院班級設(shè)計(jì)人成績
一、題目:學(xué)生成績管理系統(tǒng)
二、目的與要求:
1.目的:
培養(yǎng)學(xué)生綜合利用VisualBasic6.0語言進(jìn)行程序設(shè)計(jì)的能力,主要培養(yǎng)學(xué)生使用ACCESS數(shù)據(jù)庫和ADO控件設(shè)計(jì)信息管理類軟件。
2.基本要求:
① 要求用ACCESS搭建數(shù)據(jù)庫。
② 使用ADO控件實(shí)現(xiàn)與數(shù)據(jù)庫的連接。
③ 使用MSChart圖表控件繪制各種類型的圖表;使用MSFlexGrid表格控件顯示數(shù)據(jù)信息。④ 程序界面美觀,運(yùn)行無差錯(cuò)
3.創(chuàng)新要求:
在基本要求達(dá)到后,進(jìn)行創(chuàng)新設(shè)計(jì):
(1)允許更改密碼。
(2)增加排名次的功能。
(3)可以按院系、專業(yè)和年級計(jì)算平均成績并繪制圖表。
(4)用戶可以添加新的院系和專業(yè)名稱。
三、設(shè)計(jì)方法和基本原理:
1.功能要求:
設(shè)計(jì)一個(gè)“學(xué)生成績管理系統(tǒng)”程序,實(shí)現(xiàn)對學(xué)生成績的添加、修改、刪除、查詢和圖表繪制,具體如下:
(1)運(yùn)行程序先進(jìn)入“登錄”界面,要求輸入數(shù)據(jù)庫密碼,如果密碼錯(cuò)誤,給出提示。
(2)經(jīng)過密碼檢驗(yàn)后,顯示主界面,以表格形式顯示數(shù)據(jù)庫中所有學(xué)生的成績信息。
(3)“添加”:其中院系、專業(yè)和年級使用組合框進(jìn)行選擇。
(4)“修改”:只允許修改學(xué)生成績,不允許修改姓名、院系、專業(yè)和年級。
(5)“刪除”:可以刪除學(xué)生信息,刪除前進(jìn)行確認(rèn)。
(6)“查詢”:可以根據(jù)院系、專業(yè)和年級進(jìn)行查詢。
(7)“圖表繪制”:分別以二維條形圖、二維圓餅圖和三維條形圖的形式顯示學(xué)生成績中優(yōu)、良、中、及格和不及格的分布情況。
2.問題的解決方案:
40-1
根據(jù)問題描述,可以將問題解決分為以下幾個(gè)方面:
① 進(jìn)行需求分析確定數(shù)據(jù)庫的結(jié)構(gòu),建立相應(yīng)的數(shù)據(jù)表。
② 利用ADO控件與數(shù)據(jù)庫連接。
③ 設(shè)計(jì)主界面,要求有菜單、工具欄和狀態(tài)欄,具體內(nèi)容按功能要求自行設(shè)計(jì)。
④ 其他界面自行設(shè)計(jì),滿足基本功能要求即可。
四、難點(diǎn)與提示:
(1)本題目中數(shù)據(jù)庫文件的設(shè)計(jì)是關(guān)鍵,可按如下方法:
創(chuàng)建一個(gè)數(shù)據(jù)庫文件scores.mdb,包含三個(gè)數(shù)據(jù)表:院系、專業(yè)和成績。“院系”表中保存院系代號(hào)和名稱;“專業(yè)”表中保存專業(yè)代號(hào)和名稱,以及所屬院系的代號(hào);“成績”表中保存學(xué)生姓名、院系代號(hào)、專業(yè)代號(hào)、年級和各科成績。
(2)ADO控件和數(shù)據(jù)庫的連接代碼:
provider = “provider=Microsoft.jet.oledb.4.0”
datasource = “data source=” & App.Path & “scores.mdb”
With Adodc1
.Mode = adModeReadWrite
.ConnectionString = provider & “;” & datasource
.CommandType = adCmdTable
.RecordSource = “yx”
.Refresh
End With
五、課程設(shè)計(jì)時(shí)間:2012年5月10日至2012年7月1日
六、課程設(shè)計(jì)進(jìn)行地點(diǎn):學(xué)校機(jī)房
七、書寫設(shè)計(jì)報(bào)告的要求:
設(shè)計(jì)報(bào)告中包含以下幾個(gè)方面:
1.設(shè)計(jì)題目
2.設(shè)計(jì)思路
①劃分功能模塊
②確定各模塊的算法
3.用圖示的方式給出過程或函數(shù)之間的調(diào)用關(guān)系
4.列出程序清單,并加以必要的注釋
5.對該設(shè)計(jì)題目有何更完善的方案
6.通過本次設(shè)計(jì),有何收獲及心得體會(huì)
八、課程設(shè)計(jì)的考核方式及評分方法
40-2
1.考核方式
課程設(shè)計(jì)結(jié)束時(shí),學(xué)生要提交課程設(shè)計(jì)報(bào)告(A4紙打印),并將電子文檔和源程序上傳至課程設(shè)計(jì)服務(wù)器中:
ftp://210.31.197.23
找到自已指導(dǎo)教師的文件夾后,進(jìn)入班級文件夾,再找到自己的文件夾,然后將文檔復(fù)制到該文件夾中即可。
2.評分方法
(1)出勤率
(2)課程設(shè)計(jì)準(zhǔn)備工作
(3)課程設(shè)計(jì)期間紀(jì)律
(4)課程設(shè)計(jì)運(yùn)行結(jié)果
(5)課程設(shè)計(jì)報(bào)告
(6)答辯情況
指導(dǎo)教師: 系主任簽字:日期:40-3 年月日
第五篇:VB學(xué)生成績管理系統(tǒng)課程設(shè)計(jì)報(bào)告
VB程序設(shè)計(jì) 課程設(shè)計(jì)報(bào)告
班 級:***** 姓 名:***** 序 號(hào):***** 指導(dǎo)老師:*****
目錄
1、課設(shè)的目的..............................................................................................................................2
2、界面設(shè)計(jì)和功能設(shè)計(jì)............................................................................................................2
3、系統(tǒng)功能實(shí)施...................................................................................................................11
4、總結(jié)........................................................................................................................................30
一、課設(shè)的目的
1.本次課程設(shè)計(jì)提高了我們的實(shí)踐動(dòng)手能力
5.通過本次課程設(shè)計(jì),熟悉用戶界面的設(shè)計(jì)
2.通過本次課程設(shè)計(jì),進(jìn)一步理解計(jì)算機(jī)程序設(shè)計(jì)的思路與方法
3.本次課程設(shè)計(jì)之后,達(dá)到能熟練使用各種常見的VB控件,理解面向?qū)ο蟮乃枷?4.經(jīng)過本次課程設(shè)計(jì),我們進(jìn)一步熟練運(yùn)用VB的語言元素和流程控制語句
6.經(jīng)過本次課程設(shè)計(jì),熟悉數(shù)據(jù)訪問控件ADO及相關(guān)對象的使用,能基于ADO控件實(shí)現(xiàn)Access的數(shù)據(jù)訪問與操縱
二、界面設(shè)計(jì)和功能設(shè)計(jì)
1、下面的界面為用戶登陸界面:
用戶名和密碼均已設(shè)定,用戶名為zgzy,密碼為11201,只有輸入正確,然后點(diǎn)擊“登陸“按鈕才能進(jìn)入主界面。如果用戶名或密碼三次輸入錯(cuò)誤,則系統(tǒng)自動(dòng)退出。當(dāng)你點(diǎn)擊“退出“按鈕時(shí),彈出一個(gè)對話窗,界面如下:
在對話框上點(diǎn)擊“是”按鈕,則退出系統(tǒng),如果點(diǎn)擊“否”,則該界面不變。
2、當(dāng)用戶名和密碼均輸入正確,點(diǎn)擊“登陸”按鈕,進(jìn)入主界面——“學(xué)生成績管理系統(tǒng)”界面,該界面是其他子界面的入口,界面如下:
3、進(jìn)入主界面后,點(diǎn)擊“學(xué)生管理(刪除添加)”,進(jìn)入學(xué)生管理界面,界面如下
該界面上有一個(gè)ADO控件,用于連接數(shù)據(jù)庫,當(dāng)用戶在六個(gè)文本框中輸入數(shù)據(jù)時(shí),點(diǎn)擊“添加“按鈕,可以將數(shù)據(jù)錄入到數(shù)據(jù)庫中,如果此時(shí)點(diǎn)擊”刪除“按鈕,則剛才輸入的數(shù)據(jù)就會(huì)被刪除,點(diǎn)擊”保存“按鈕時(shí),輸入的數(shù)據(jù)就會(huì)自動(dòng)保存在數(shù)據(jù)庫里,點(diǎn)擊”返回主窗體“按鈕,該窗體消失,主窗體出現(xiàn)。
4、在主界面點(diǎn)擊“各科成績查詢“按鈕,出現(xiàn)如下界面:
該界面有一個(gè)ADO控件,用來連接數(shù)據(jù)庫,還有一個(gè)DataGrid控件,用來顯示學(xué)生成績的查詢結(jié)果,當(dāng)用戶選擇了要查詢的科目和條件后,點(diǎn)擊“查詢“按鈕,在DataGrid控件上就會(huì)顯示出所查詢的結(jié)果。下面為輸入條件后查詢的結(jié)果——
5、在主界面點(diǎn)擊“姓名查詢“按鈕后,會(huì)出現(xiàn)如下界面:
該界面與上一界面相似,在文本框輸入要查詢的姓名后,點(diǎn)擊“查詢“按鈕,就會(huì)在DataGrid控件上顯示所要查詢的結(jié)果。下面為輸入條件后查詢的結(jié)果——
5、在主界面點(diǎn)擊“班級查詢“按鈕后,會(huì)出現(xiàn)如下界面:
在文版框中輸入所要查詢的班級,DataGrid控件上就會(huì)顯示所要查詢的結(jié)果。下面為輸入條件后查詢的結(jié)果——
6、在主界面上點(diǎn)擊“各科成績段查詢“按鈕后,會(huì)出現(xiàn)如下界面:
點(diǎn)擊“計(jì)算分?jǐn)?shù)段統(tǒng)計(jì)“按鈕后,就會(huì)出現(xiàn)所要查詢的結(jié)果。下面為查詢的結(jié)果——
7、在主界面點(diǎn)擊“計(jì)算總分“按鈕后,出現(xiàn)如下界面:
點(diǎn)擊“清除總分”按鈕后,出現(xiàn)如下界面
8、在主界面點(diǎn)擊“排名“按鈕后,出現(xiàn)如下界面:
在該界面上點(diǎn)擊“排名“按鈕后,在DataGrid控件上會(huì)顯示出按成績高低排名的結(jié)果,點(diǎn)擊”清除排名“按鈕后,剛才結(jié)果消失,顯示原來結(jié)果。下面為所現(xiàn)實(shí)的結(jié)果——
9、在主界面點(diǎn)擊“統(tǒng)計(jì)直方圖“按鈕后,出現(xiàn)如下界面:
在該界面點(diǎn)擊各個(gè)按鈕后,就會(huì)出現(xiàn)與之相關(guān)科目的成績統(tǒng)計(jì)直方圖,下面為查詢的結(jié)果——
10、在主界面點(diǎn)擊“優(yōu)等生“按鈕后,出現(xiàn)如下界面:
點(diǎn)擊按鈕查詢后,結(jié)果就會(huì)在界面上顯示出來。下面為所查詢的結(jié)果——
三、系統(tǒng)功能實(shí)施
以上展示的是系統(tǒng)的所有界面,怎樣才能讓這所有的功能實(shí)現(xiàn)呢?數(shù)據(jù)庫和ADO控件的使用便是其中的關(guān)鍵。
1、建立如下數(shù)據(jù)庫
(學(xué)號(hào)、姓名、班級、英語、數(shù)學(xué)、VB、總分、排名)
2、建立如下圖的所有界面:
3、ADO控件和DataGrid控件以及數(shù)據(jù)庫的連接步驟:(這一步在設(shè)計(jì)界面的同時(shí)完成)
(1)、如何加載ADO控件: 步驟1:
步驟2:
步驟3:
各個(gè)界面的ADO控件如何連接數(shù)據(jù)庫(分兩步):
步驟1:
如下面界面中的5個(gè)步驟
步驟2:
選中ADO控件Adodc1,點(diǎn)擊鼠標(biāo)右鍵選擇屬性,然后界面設(shè)置如下:
控件綁定數(shù)據(jù)庫的字段操作說明:
屬性設(shè)置說明:下面以學(xué)號(hào)為例,姓名、班級等都可參考此。將學(xué)號(hào)對應(yīng)的文本框Text1連接Adodc1顯示數(shù)據(jù)庫中的學(xué)號(hào),需要設(shè)置DataSource和DataField兩個(gè)屬性,首先選中Text1文本框,并進(jìn)行下面的兩步操作,即可綁定數(shù)據(jù)庫的學(xué)號(hào)字段。
設(shè)置DataSource:
設(shè)置DataField:
(2)、如何加載DataGrid控件 控件DataGrid,可以實(shí)現(xiàn)數(shù)據(jù)的批量處理,該控件在控件庫Microsoft DataGrid Control 6.0中。
說明:DataGrid控件屬性設(shè)置
以下為各個(gè)界面所對應(yīng)的代碼——
該界面代碼如下:
Private Sub Command1_Click()If Text1.Text = “zgzy” And Text2.Text = “11201” Then Form1.Show Unload me Else MsgBox “用戶名或密碼錯(cuò)誤,請重新輸入”, vbMsgBoxSetForeground, “系統(tǒng)提示!” End If
Static t As Integer t = t + 1 If t >= 3 Then End End Sub
Private Sub Command2_Click()a = MsgBox(“確定要退出本系統(tǒng)嗎?”, 3 + 32 + 256, “系統(tǒng)提示!”)
If a = 6 Then Unload Me End If End Sub
該界面代碼如下:
Private Sub Command1_Click()xsglfrm.Show End Sub Private Sub Command10_Click()ydsfrm.Show End Sub Private Sub Command3_Click()jszffrm.Show End Sub Private Sub Command4_Click()
pmfrm.Show End Sub Private Sub Command5_Click()
zftjtfrm.Show End Sub Private Sub Command6_Click()
cjcxfrm.Show End Sub Private Sub Command7_Click()
xmcxfrm.Show End Sub Private Sub Command8_Click()
bjcxfrm.Show End Sub Private Sub Command9_Click()
gkcjfrm.Show End Sub
該界面代碼如下:
Private Sub Command1_Click()Me.Adodc1.Recordset.AddNew End Sub
Private Sub Command2_Click()If Me.Adodc1.Recordset.RecordCount = 0 Or Me.Adodc1.Recordset.EOF Then
Exit Sub End If Me.Adodc1.Recordset.Delete Me.Adodc1.Recordset.MoveNext If Me.Adodc1.Recordset.RecordCount = 0 Then
Exit Sub End If If Me.Adodc1.Recordset.EOF Then Me.Adodc1.Recordset.MoveLast End Sub
Private Sub Command4_Click()Me.Adodc1.Recordset.Save End Sub
Private Sub Command5_Click()
Unload Me
mainfrm.Show End Sub
該界面代碼如下: Dim kc_條件 As String Dim kc As String Private Sub Command1_Click()kc_條件 = Me.Text1 Me.Adodc1.RecordSource = “select * from stu where ” + kc + “ ” + kc_條件 Me.Adodc1.Refresh End Sub
Private Sub Form_Load()kc_條件 = “>=92” kc = “vb” End Sub
Private Sub Option1_Click()
kc = “VB” End Sub Private Sub Option2_Click()kc = “math” End Sub Private Sub Option3_Click()kc = “English” End Sub
該界面代碼如下:
Dim kc_條件 As String Dim kc As String Private Sub Command1_Click()kc_條件 = Me.Text1 Me.Adodc1.RecordSource = “select * from stu where ” + kc + “='” + kc_條件 + “'” Me.Adodc1.Refresh End Sub
Private Sub Form_Load()kc = “name” End Sub
該界面代碼如下: Dim kc_條件 As String Dim kc As String Private Sub Command1_Click()kc_條件 = Me.Text1 Me.Adodc1.RecordSource = “select * from stu where ” + kc + “='” + kc_條件 + “'” Me.Adodc1.Refresh End Sub
Private Sub Form_Load()kc = “class” End Sub
該界面代碼如下:
Private Sub Command1_Click()
Dim vb_A As Integer
Dim vb_B As Integer
Dim vb_C As Integer
Dim vb_D As Integer
Dim vb_E As Integer
Dim Math_A As Integer
Dim Math_B As Integer
Dim Math_C As Integer
Dim Math_D As Integer
Dim Math_E As Integer
Dim English_A As Integer
Dim English_B As Integer
Dim English_C As Integer
Dim English_D As Integer
Dim English_E As Integer
Me.Adodc1.RecordSource = “select * from stu where vb>=90”
Me.Adodc1.Refresh
vb_A = Me.Adodc1.Recordset.RecordCount
Me.Text1 = vb_A
Me.Adodc1.RecordSource = “select * from stu where vb>=80 and vb<90”
Me.Adodc1.Refresh
vb_B = Me.Adodc1.Recordset.RecordCount
Me.Text2 = vb_B
Me.Adodc1.RecordSource = “select * from stu where vb>=70 and vb<80”
Me.Adodc1.Refresh
vb_C = Me.Adodc1.Recordset.RecordCount
Me.Text3 = vb_C
Me.Adodc1.RecordSource = “select * from stu where vb>=60”
Me.Adodc1.Refresh
vb_D = Me.Adodc1.Recordset.RecordCount
Me.Text4 = vb_D
Me.Adodc1.RecordSource = “select * from stu where vb<60”
Me.Adodc1.Refresh
vb_B = Me.Adodc1.Recordset.RecordCount
Me.Text5 = vb_E
Me.Adodc1.RecordSource = “select * from stu where math>=90”
Me.Adodc1.Refresh
Math_A = Me.Adodc1.Recordset.RecordCount
Me.Text6 = Math_A
Me.Adodc1.RecordSource = “select * from stu where math>=80 and math<90”
Me.Adodc1.Refresh
Math_B = Me.Adodc1.Recordset.RecordCount
Me.Text7 = Math_B
Me.Adodc1.RecordSource = “select * from stu where math>=70 and math<80”
Me.Adodc1.Refresh
Math_C = Me.Adodc1.Recordset.RecordCount
Me.Text8 = Math_C
Me.Adodc1.RecordSource = “select * from stu where math>=60 ”
Me.Adodc1.Refresh
Math_D = Me.Adodc1.Recordset.RecordCount
Me.Text9 = Math_D
Me.Adodc1.RecordSource = “select * from stu where math<60”
Me.Adodc1.Refresh
Math_E = Me.Adodc1.Recordset.RecordCount
Me.Text10 = Math_E
Me.Adodc1.RecordSource = “select * from stu where english>=90”
Me.Adodc1.Refresh
English_A = Me.Adodc1.Recordset.RecordCount
Me.Text11 = English_A
Me.Adodc1.RecordSource = “select * from stu where english>=80 and english<90”
Me.Adodc1.Refresh
English_B = Me.Adodc1.Recordset.RecordCount
Me.Text12 = English_B
Me.Adodc1.RecordSource = “select * from stu where english>=70 and english<80”
Me.Adodc1.Refresh
English_C = Me.Adodc1.Recordset.RecordCount
Me.Text13 = English_C
Me.Adodc1.RecordSource = “select * from stu where english>=60”
Me.Adodc1.Refresh
English_D = Me.Adodc1.Recordset.RecordCount
Me.Text14 = English_D
Me.Adodc1.RecordSource = “select * from stu where english<60”
Me.Adodc1.Refresh
English_E = Me.Adodc1.Recordset.RecordCount
Me.Text15 = English_E End Sub
Private Sub Form_Load()
Text1.Text = “"
Text2.Text = ”“
Text3.Text = ”“
Text4.Text = ”“
Text5.Text = ”“
Text6.Text = ”“
Text7.Text = ”“
Text8.Text = ”“
Text10.Text = ”“
Text11.Text = ”“
Text12.Text = ”“
Text13.Text = ”“
Text14.Text = ”“
Text15.Text = ”“ End Sub
代碼如下
Private Sub Command1_Click()'計(jì)算總分 Dim vb As Integer
Dim math As Integer Dim english As Integer Me.Adodc1.Recordset.MoveFirst For i = 1 To Me.Adodc1.Recordset.RecordCount
vb = Me.Adodc1.Recordset.Fields(”vb“).Value
math = Me.Adodc1.Recordset.Fields(”math“).Value
english = Me.Adodc1.Recordset.Fields(”english“).Value
Me.Adodc1.Recordset.Fields(”total“).Value = vb + math + english
Me.Adodc1.Recordset.Update
Me.Adodc1.Recordset.MoveNext Next i End Sub
Private Sub Command2_Click()'清除總分 Me.Adodc1.Recordset.MoveFirst For i = 1 To Me.Adodc1.Recordset.RecordCount
Me.Adodc1.Recordset.Fields(”total“).Value = Null
Me.Adodc1.Recordset.Update
Me.Adodc1.Recordset.MoveNext Next i End Sub
該界面代碼如下:
Private Sub Command1_Click()Me.Adodc1.RecordSource = ”select * from stu order by total desc“ Me.Adodc1.Refresh Me.Adodc1.Recordset.MoveFirst For i = 1 To Me.Adodc1.Recordset.RecordCount
Me.Adodc1.Recordset.Fields(”mc“).Value = i
Me.Adodc1.Recordset.Update
Me.Adodc1.Recordset.MoveNext
Next i End Sub
Private Sub Command2_Click()Me.Adodc1.Recordset.MoveFirst For i = 1 To Me.Adodc1.Recordset.RecordCount
Me.Adodc1.Recordset.Fields(”mc“).Value = Null
Me.Adodc1.Recordset.Update
Me.Adodc1.Recordset.MoveNext Next i End Sub
該界面代碼如下:
Private Sub Command1_Click()
Me.Adodc1.Refresh
'填充表格數(shù)據(jù)
MSChart1.RowCount = 1
MSChart1.ColumnCount = Me.Adodc1.Recordset.RecordCount
Me.Adodc1.Recordset.MoveFirst
For lngI = 1 To Me.Adodc1.Recordset.RecordCount
MSChart1.Column = lngI
'用Data屬性向MSChart數(shù)據(jù)網(wǎng)格填充數(shù)據(jù)
MSChart1.Data = Val(Adodc1.Recordset.Fields(”vb“).Value)
MSChart1.ColumnLabel = Adodc1.Recordset.Fields(”name“).Value
Adodc1.Recordset.MoveNext
Next lngI
MSChart1.RowLabel = ”VB成績直方圖“ End Sub
Private Sub Command2_Click()Me.Adodc1.Refresh
'填充表格數(shù)據(jù)
MSChart1.RowCount = 1
MSChart1.ColumnCount = Me.Adodc1.Recordset.RecordCount
Me.Adodc1.Recordset.MoveFirst
For lngI = 1 To Me.Adodc1.Recordset.RecordCount
MSChart1.Column = lngI
'用Data屬性向MSChart數(shù)據(jù)網(wǎng)格填充數(shù)據(jù)
MSChart1.Data = Val(Adodc1.Recordset.Fields(”math“).Value)
MSChart1.ColumnLabel = Adodc1.Recordset.Fields(”name“).Value
Adodc1.Recordset.MoveNext
Next lngI
MSChart1.RowLabel = ”Math成績直方圖“ End Sub
該界面代碼如下
Private Sub Command1_Click()Dim vb As Integer Dim math As Integer Dim english As Integer
Me.Adodc1.RecordSource = ”select * from stu where((math+english+vb)/3>=90)or((math+english+vb)/3>=85 and(math=100 or english=100 or vb=100))or((vb+english+math)/3>=85 and((vb>=95 and english >=95)or(english>=95 and math>=95)or(math>=95 and vb>=95)))and(mc<=3)and(vb>=60 and english>=60 and math>=60)" Me.Adodc1.Refresh End Sub
四、總結(jié)和體會(huì)
經(jīng)過好幾天的努力我的課程設(shè)計(jì)終于完成了。在沒有做課程設(shè)計(jì)以前覺得課程設(shè)計(jì)好難,我可能做不了,但是通過這次做課程設(shè)計(jì)發(fā)現(xiàn)自己錯(cuò)了。課程設(shè)計(jì)不僅是對前面所學(xué)知識(shí)的一種檢驗(yàn),而且也是對自己能力的一種提高,它并不可怕。通過這次課程設(shè)計(jì)使我明白了自己原來知識(shí)還比較欠缺,自己要學(xué)習(xí)的東西還太多,以前上課沒怎么認(rèn)真聽,現(xiàn)在知道它重要了,幸好為時(shí)不晚,我以后要更加的努力學(xué)好vb。在這次課程設(shè)計(jì)中也使我們的同學(xué)關(guān)系更進(jìn)一步了,同學(xué)之間互相幫助,有什么不懂的大家在一起商量,聽聽不同的看法對我們更好的理解知識(shí),所以在這里非常感謝幫助我的同學(xué)。此外,還得出一個(gè)結(jié)論:世上無難事,只怕有心人。
在設(shè)計(jì)過程中,我通過查閱有關(guān)資料,與同學(xué)交流經(jīng)驗(yàn)和自學(xué)等方式,使自己學(xué)到了不少知識(shí),也經(jīng)歷了不少艱辛,但收獲同樣巨大。在整個(gè)設(shè)計(jì)中我懂得了許多東西,也培養(yǎng)了我獨(dú)立工作的能力,樹立了對自己工作能力的信心,相信會(huì)對今后的學(xué)習(xí)工作生活有非常重要的影響。而且大大提高了動(dòng)手的能力,使我充分體會(huì)到了在創(chuàng)造過程中探索的艱難和成功時(shí)的喜悅。雖然這個(gè)設(shè)計(jì)做的也不太好,但是在設(shè)計(jì)過程中所學(xué)到的東西是這次課程設(shè)計(jì)的最大收獲和財(cái)富,使我終身受益。