




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、登錄界面圖4.1登錄界面設計過程:用于輸入用戶名和密碼登錄,選擇相應的用戶類型進入系統,若是用戶類型選擇錯誤則不能進入系統。沒有用戶名的可注冊用戶名,如對系統操作有不了解的可點擊幫助,進入幫助界面。輸入用戶名和密碼后點擊確定判斷數據庫中的用戶是否為合法用戶。設計代碼:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '選擇普通用戶登錄 If Me.RadioButton1.Checked Then Dim str As S
2、tring str = "data source=PC-201103171305SQLEXPRESS;database=學生信息庫;user id=sa;pwd=" Dim con As New SqlClient.SqlConnection(str) Try con.Open() Catch ex As Exception End Try Dim sql As String = "select * from 普通用戶where 用戶名='" & TextBox1.Text.ToString().Trim() & "
3、39; and 密碼='" & TextBox2.Text.ToString().Trim() & " '" Dim cmd As New SqlClient.SqlCommand(sql, con) Dim reader As SqlClient.SqlDataReader Try reader = cmd.ExecuteReader If reader.Read() = True Then Dim 學生成績管理系統As New 學生信息管理系統 學生成績管理系統.添加DToolStripMenuItem.Enabled = Fa
4、lse 學生成績管理系統.修改KToolStripMenuItem.Enabled = False 學生成績管理系統.刪除DToolStripMenuItem.Enabled = False 學生成績管理系統.添加ToolStripMenuItem.Enabled = False 學生成績管理系統.高級用戶信息管理ToolStripMenuItem.Enabled = False 學生成績管理系統.Show() Me.Hide() Else MsgBox("對不起,用戶名或密碼錯誤!重新輸入(請正確選擇用戶類型)", 16, "警告") Me.TextB
5、ox1.Text = "" Me.TextBox2.Text = "" TextBox1.Focus() End If Catch ex As Exception End Try End If '選擇高級用戶登錄 If Me.RadioButton2.Checked Then Dim str As String str = "data source=PC-201103171305SQLEXPRESS;database=學生信息庫;user id=sa;pwd=" Dim con As New SqlClient.SqlConn
6、ection(str) Try con.Open() Catch ex As Exception End Try Dim sql As String = "select * from 高級用戶where 用戶名='" & TextBox1.Text.ToString().Trim() & "' and 密碼='" & TextBox2.Text.ToString().Trim() & " '" Dim cmd As New SqlClient.SqlCommand(sql
7、, con) Dim reader As SqlClient.SqlDataReader Try reader = cmd.ExecuteReader If reader.Read() = True Then Dim 學生成績管理系統As New 學生信息管理系統 學生成績管理系統.添加ToolStripMenuItem.Enabled = False 學生成績管理系統.Show() Me.Hide() Else MsgBox("對不起,用戶名或密碼錯誤!重新輸入(請正確選擇用戶類型)", 16, "警告") Me.TextBox1.Text = &qu
8、ot;" Me.TextBox2.Text = "" TextBox1.Focus() End If Catch ex As Exception End Try End If '選擇超級用戶登錄 If Me.RadioButton3.Checked Then Dim str As String str = "data source=PC-201103171305SQLEXPRESS;database=學生信息庫;user id=sa;pwd=" Dim con As New SqlClient.SqlConnection(str) Tr
9、y con.Open() Catch ex As Exception End Try Dim sql As String = "select * from 超級用戶where 用戶名='" & TextBox1.Text.ToString().Trim() & "' and 密碼='" & TextBox2.Text.ToString().Trim() & " '" Dim cmd As New SqlClient.SqlCommand(sql, con) Dim rea
10、der As SqlClient.SqlDataReader Try reader = cmd.ExecuteReader If reader.Read() = True Then Dim 學生成績管理系統As New 學生信息管理系統 學生成績管理系統.Show() Me.Hide() Else MsgBox("對不起,用戶名或密碼錯誤!重新輸入(請正確選擇用戶類型)", 16, "警告") Me.TextBox1.Text = "" Me.TextBox2.Text = "" TextBox1.Focus()
11、End If Catch ex As Exception End Try End If End Sub學生成績管理界面圖4.2學生成績管理界面設計過程:所有功能都在菜單中打開來實現。在登錄時選擇的用戶類型限制本界面功能使用的權限,不同的用戶類型所顯示可用的功能不一樣。普通用戶可使用界面管理功能、學生信息管理中的查詢功能、登錄用戶管理中的普通用戶管理功能;高級用戶擁有普通用戶所有功能使用的權限,外加登錄用戶管理中的高級用戶管理功能;超級用戶擁有高級用戶所有的功能使用的權限,外加超級用戶管理功能;所有登錄的用戶都可使用界面管理功能和幫助功能。不同的權限擁有不同的功能。設計代碼:Public Cla
12、ss 學生信息管理系統Private Sub 添加DToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 添加DToolStripMenuItem.Click Dim tianjia As New 添加 tianjia.MdiParent = Me tianjia.Show() End SubPrivate Sub 修改KToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.
13、EventArgs) Handles 修改KToolStripMenuItem.Click Dim xiugai As New 修改 xiugai.MdiParent = Me xiugai.Show() End SubPrivate Sub 刪除DToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 刪除DToolStripMenuItem.Click Dim shanchu As New 刪除 shanchu.MdiParent = Me shanchu.Sho
14、w() End SubPrivate Sub 退出XToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出XToolStripMenuItem.Click End End SubPrivate Sub 返回ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 返回ToolStripMenuItem.Click 登陸界面.Show()
15、Me.Close() End SubPrivate Sub 信息查詢ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim chaxun As New 查詢 chaxun.MdiParent = Me chaxun.Show() End SubPrivate Sub 添加ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 添加ToolStripM
16、enuItem.Click Dim yonghuguanli As New 用戶信息管理 yonghuguanli.MdiParent = Me yonghuguanli.Show() End SubPrivate Sub 查詢ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 查詢ToolStripMenuItem.Click Dim chaxun As New 查詢 chaxun.MdiParent = Me chaxun.Show() End SubPriv
17、ate Sub 窗口層疊ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 窗口層疊ToolStripMenuItem.Click Me.LayoutMdi(MdiLayout.Cascade) End SubPrivate Sub 水平平鋪ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 水平平鋪ToolStripMenuItem
18、.Click Me.LayoutMdi(MdiLayout.TileHorizontal) End SubPrivate Sub 垂直平鋪ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 垂直平鋪ToolStripMenuItem.Click Me.LayoutMdi(MdiLayout.TileVertical) End SubPrivate Sub 修改密碼ToolStripMenuItem_Click(ByVal sender As System.Obje
19、ct, ByVal e As System.EventArgs) Handles 修改密碼ToolStripMenuItem.Click Dim 修改密碼As New 高級用戶密碼修改 修改密碼.MdiParent = Me 修改密碼.Show() End SubPrivate Sub 修改普通用戶ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 修改普通用戶ToolStripMenuItem.Click Dim 修改密碼As New 普通用戶密碼修改 修改密碼
20、.MdiParent = Me 修改密碼.Show() End SubPrivate Sub 幫助ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 幫助ToolStripMenuItem.Click Dim 幫助As New 幫助文件 幫助.MdiParent = Me 幫助.Show() End SubEnd Class學生信息管理學生信息添加圖4.3.1學生信息添加學生基本信息添加設計過程:選擇學生信息添加,在相應的欄目填入或選擇相應的內容,點擊添加后數據存
21、入學生信息表。點擊退出則退出整個管理系統,點擊返回則退回到學生成績管理界面。(選擇學生信息添加后學生成績添加為不可用)設計代碼:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If Me.TextBox1.Text.Trim = String.Empty Then MessageBox.Show("學號不能為空", "添加失敗", MessageBoxButtons.OK, Message
22、BoxIcon.Error) ElseIf Me.TextBox2.Text.Trim = String.Empty Then MessageBox.Show("姓名不能為空", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim str As String = "select * from 學生信息表" & " where 學號='" & Me.TextBox1.Text.Trim & "'&q
23、uot; If link(str).Rows.Count = 0 Then str = Nothing str = "insert into 學生信息表" & " (學號,姓名,年齡,班級,籍貫,性別) values ('" & Me.TextBox1.Text.Trim & "','" & Me.TextBox2.Text.Trim & "','" & Me.TextBox5.Text.Trim & "
24、9;,'" & ComboBox3.Text.Trim & "','" & Me.ComboBox2.Text.Trim & "','" & ComboBox1.Text.Trim & "')" link(str) xuehao() End If str = "select * from 成績表" & " where 學號='" & Me.TextBox1.Text.
25、Trim & "'" If link(str).Rows.Count = 0 Then str = Nothing str = "insert into 成績表(學號,姓名) values ('" & Me.TextBox1.Text.Trim & "','" & Me.TextBox2.Text.Trim & "')" link(str) xuehao() End If str = "select * from 成績表&qu
26、ot; & " where 學號='" & Me.TextBox1.Text.Trim & "'" If link(str).Rows.Count = 0 Then str = Nothing str = "insert into 成績表(學號,姓名) values ('" & Me.TextBox1.Text.Trim & "','" & Me.TextBox2.Text.Trim & "')&quo
27、t; link(str) MessageBox.Show("學生信息表記錄" & Me.TextBox1.Text & "已成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information) xuehao() Else MessageBox.Show("記錄" & Me.TextBox1.Text & "已存在", "添加失敗", MessageBoxButtons.OK, Messag
28、eBoxIcon.Error) End If End IfEnd Sub學生成績信息添加設計過程:選擇學生成績添加,在相應的欄目選擇添加內容(上學期、下學期、科目、學號、成績),點擊添加后數據存入學生成績表(成績表1或者成績表2)。點擊退出則退出整個管理系統,點擊返回則退回到學生成績管理界面。(選擇學生成績添加后學生信息添加為不可用)設計代碼:Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click If Me.txt_chengji.T
29、ext.Trim = String.Empty Then MessageBox.Show("成績不能為空", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If Me.cb_xueqi.SelectedIndex = 0 Then Str = "update 成績表set " & Me.cb_kecheng.Text.Trim & "= '" & Me.txt_chengji.Text.Trim & &quo
30、t;' where 學號='" & Me.cb_xuehao.Text.Trim & "'" If Int(Me.txt_chengji.Text.Trim) >= 0 And Int(Me.txt_chengji.Text.Trim) <= 100 Then link(Str) MessageBox.Show("記錄添加已成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information) xuehao() Else
31、 MessageBox.Show("記錄成績已存在", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) End If ElseIf Me.cb_xueqi.SelectedIndex = 1 Then Str = "update 成績表set " & Me.cb_kecheng1.Text.Trim & "= '" & Me.txt_chengji.Text.Trim & "' where 學號=
32、9;" & Me.cb_xuehao.Text.Trim & "'" If Int(Me.txt_chengji.Text.Trim) >= 0 And Int(Me.txt_chengji.Text.Trim) <= 100 Then link(Str) MessageBox.Show("記錄添加已成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information) xuehao() Else MessageBox.Show(&qu
33、ot;記錄成績已存在", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) End If End If End If End Sub學生信息修改圖4.3.2學生信息修改學生基本信息修改設計過程:選擇修改信息類型為學生信息,在相應的欄目選擇或填入相應的內容(學號、類型、修改內容)。點擊修改讀取數據庫中的學生信息表的相應內容,改為填入的所要修改的內容。設計代碼:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Eve
34、ntArgs) Handles Button1.Click If Me.RadioButton3.Checked Then str = "update 學生信息表set " & Me.ComboBox4.Text.Trim & "='" & Me.TextBox1.Text.Trim & "' where 學號='" & Me.ComboBox3.Text.Trim & "'" End If If Not link(str).Rows.
35、Count Then MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question) End IfEnd Sub學生成績信息修改設計過程:選擇修改信息類型為學生成績,在相應的欄目選擇或填入相應的內容(學號、選擇課程、改成績)。點擊修改讀取數據庫中的成績表的相應內容,改為填入的所要修改的內容。設計代碼:Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArg
36、s) Handles Button3.Click If Me.RadioButton1.Checked Then str = "update 成績表set " & Me.ComboBox1.Text.Trim & "='" & Me.TextBox4.Text.Trim & "' where 學號='" & Me.ComboBox5.Text.Trim & "'" ElseIf Me.RadioButton2.Checked Then
37、str = "update 成績表set " & Me.ComboBox2.Text.Trim & "='" & Me.TextBox4.Text.Trim & "' where 學號='" & Me.ComboBox5.Text.Trim & "'" End If If Not link(str).Rows.Count Then If Int(Me.TextBox4.Text.Trim) >= 0 And Int(Me.Text
38、Box4.Text.Trim) <= 100 Then MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question) Else MsgBox("對不起,您輸入的成績有誤!請重新輸入", 16, "警告") End If End If End Sub學生信息刪除圖4.3.3學生信息刪除設計過程:選擇所要刪除的信息類型,在學號欄目選擇相應的學號。點擊刪除,則在相應的表中刪除信息。設計代碼:Private Sub Butt
39、on1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Me.RadioButton1.Checked Then Dim str As String = "delete from 成績表where 學號='" & ComboBox1.Text.Trim & "'" link(str) MessageBox.Show("刪除記錄" & ComboBox1.Text
40、& "成功", "刪除成功", MessageBoxButtons.OK, MessageBoxIcon.Information) tianxuehao() End If If Me.RadioButton2.Checked Then Dim str As String = "delete from 成績表where 學號='" & ComboBox1.Text.Trim & "'" link(str) MessageBox.Show("刪除記錄" &am
41、p; ComboBox1.Text & "成功", "刪除成功", MessageBoxButtons.OK, MessageBoxIcon.Information) tianxuehao() End If If Me.RadioButton3.Checked Then Dim str As String = "delete from 學生信息表where 學號='" & ComboBox1.Text.Trim & "'" link(str) MessageBox.Show(
42、"刪除記錄" & ComboBox1.Text & "成功", "刪除成功", MessageBoxButtons.OK, MessageBoxIcon.Information) tianxuehao() End IfEnd Sub5.3.4學生信息查詢圖4.3.4學生信息查詢設計過程:選擇查詢的學生信息類型,輸入所要查詢的學生學號,點擊查詢即可,在下面會顯示你所查詢學生信息。點擊刷新能及時更新最新的學生信息。設計代碼:Private Sub Button1_Click(ByVal sender As System.O
43、bject, ByVal e As System.EventArgs) Handles Button1.Click If Me.RadioButton1.Checked Then xh = "select * from 成績表where 學號='" & Me.TextBox2.Text.Trim & "' " ElseIf Me.RadioButton2.Checked Then xh = "select * from 成績表where 學號='" & Me.TextBox2.Text.
44、Trim & "' " ElseIf Me.RadioButton3.Checked Then xh = "select * from 學生信息表where 學號='" & Me.TextBox2.Text.Trim & "' " End If tianxuehao()End SubPrivate Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Cl
45、ick Me.TextBox2.Text = "" If Me.RadioButton1.Checked Then xh = "select * from 成績表" tianxuehao() ElseIf Me.RadioButton2.Checked Then xh = "select * from 成績表" tianxuehao() ElseIf Me.RadioButton3.Checked Then xh = "select * from 學生信息表" tianxuehao() End IfEnd Sub登
46、錄用戶管理普通用戶管理圖4.4.1普通用戶管理設計過程:在普通用戶密碼修改界面,輸入所要修改的自己或者別人的用戶名,填入新的密碼,點擊提交即可修改相應的用戶名密碼。設計代碼:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click xh = "select * from 普通用戶 where 用戶名='" & Me.TextBox1.Text.Trim & "' "
47、If Me.TextBox2.Text.Trim = String.Empty Then MessageBox.Show("密碼不能為空", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) Else str = "update 普通用戶 set 密碼='" & Me.TextBox2.Text.Trim & "'where 用戶名='" & Me.TextBox1.Text.Trim & "
48、39;" If Not link(str).Rows.Count Then MessageBox.Show("修改普通用戶密碼成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question) End If End IfEnd Sub高級用戶管理圖4.4.2高級用戶管理設計過程:在高級用戶密碼修改界面,輸入所要修改的自己或者別人的用戶名,填入新的密碼,點擊提交即可修改相應的用戶名密碼。設計代碼:Private Sub Button1_Click(ByVal sender As System.Ob
49、ject, ByVal e As System.EventArgs) Handles Button1.Click xh = "select * from 高級用戶 where 用戶名='" & Me.TextBox1.Text.Trim & "' " If Me.TextBox2.Text.Trim = String.Empty Then MessageBox.Show("密碼不能為空", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Er
50、ror) Else Str = "update 高級用戶 set 密碼='" & Me.TextBox2.Text.Trim & "'where 用戶名='" & Me.TextBox1.Text.Trim & "'" If Not link(Str).Rows.Count Then MessageBox.Show("修改高級用戶密碼成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Q
51、uestion) End If End IfEnd Sub超級用戶管理圖4.4.3超級用戶管理設計過程:正確選擇所要操作的用戶類型,在用戶信息管理界面可添加用戶、修改用戶、刪除用戶、查詢用戶等功能,這是一個只有超級用戶才擁有的權限功能,這個界面功能可操作學生成績管理系統的用戶登錄信息,方面了超級用戶對用戶名和密碼的管理。設計代碼:用戶添加代碼:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Me.TextBox1.Text
52、.Trim = String.Empty Then MessageBox.Show("用戶名不能為空", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) ElseIf Me.TextBox2.Text.Trim = String.Empty Then MessageBox.Show("密碼不能為空", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) End If If Me.RadioButton1.Ch
53、ecked Then Dim str As String = "select * from 普通用戶" & " where 用戶名='" & Me.TextBox1.Text.Trim & "'" If link(str).Rows.Count = 0 Then str = Nothing str = "insert into 普通用戶" & " (用戶名,密碼) values ('" & Me.TextBox1.Text.Trim
54、 & "','" & Me.TextBox2.Text.Trim & "')" link(str) MessageBox.Show("普通用戶" & Me.TextBox1.Text & "已成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("記錄" & Me.TextBox1.Text
55、& "已存在", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Error) End If End If If Me.RadioButton2.Checked Then Dim str As String = "select * from 高級用戶" & " where 用戶名='" & Me.TextBox1.Text.Trim & "'" If link(str).Rows.Count = 0 Then str = Nothing str = "insert into 高級用戶" & " (用戶名,密碼) values ('" & Me.TextBox1.Text.Trim & "','" & Me.TextBox2.Text.Trim & "')" link(st
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025內蒙古土地資源收儲投資(集團)有限公司常態化招聘50名急需緊缺專業人員(第十二批)筆試參考題庫附帶答案詳解
- 文化創意產品代理銷售合同(2篇)
- 2025項目部治理人員安全培訓考試試題【達標題】
- 2025廣告宣傳活動合同模板
- 2025年監理工程師考試《合同管理》核心考點剖析
- 2025智能安防系統建設項目合同
- 2025質量管理體系認證合同范本
- 2025飲品類采購合同范本
- 2025年羥丙纖維素合作協議書
- 2025標準土地租賃協議合同
- 2025年高考歷史總復習高中歷史必修二八大專題知識復習提綱
- 2025事業單位考試題庫及答案200題
- 臨床執業醫師考試健康教育技能試題及答案
- 機車車輛試題及答案
- 地理澳大利亞課件-2024-2025學年人教版(2024)初中地理七年級下冊
- 常用施工規定和技術要求1
- 旅游景區娛樂服務設計
- 亞馬遜店鋪轉讓合同標準文本
- T-CQAP 4002-2024 醫療安全(不良)事件根本原因分析法活動指南
- 新版《醫療器械經營質量管理規范》(2024)培訓試題及答案
- 大數據與人工智能營銷(南昌大學)知到智慧樹章節答案
評論
0/150
提交評論