




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、【精品文檔】如有侵權(quán),請(qǐng)聯(lián)系網(wǎng)站刪除,僅供學(xué)習(xí)與交流學(xué)生信息管理系統(tǒng)代碼.精品文檔.主要代碼如下:1、登錄界面代碼:Dim cn As New ADODB.ConnectionDim rst As New ADODB.RecordsetPrivate Sub Command1_Click() Set cn = New ADODB.Connection Set rst = New ADODB.Recordset Static i% cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID
2、=sa;Initial Catalog=students info;Data Source=C1847" cn.Open usna = Trim(Text1.Text) mysql = "select * from 用戶表 where 用戶名='" & usna & "'" rst.Open mysql, cn If rst.EOF Then MsgBox "用戶名不存在!" cn.Close Text1.Text = "" Text2.Text = ""
3、; Text1.SetFocus Else If Trim(rst("密碼") = Trim(Text2.Text) Then 管理界面.Show Else i = i + 1 If i < 3 Then MsgBox "用戶名或密碼錯(cuò)誤!", vbOKOnly + vbExclamation, "警告" cn.Close Text2.Text = "" Text1.Text = "" Text1.SetFocus Else MsgBox "該用戶已被鎖定!", vbO
4、KOnly + vbExclamation, "警告" End If End If End If End SubPrivate Sub Command2_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub2、管理界面代碼:Private Sub Sinsert_Click()添加學(xué)生信息.ShowEnd SubPrivate Sub Sselect_Click()查詢學(xué)生信息.ShowEnd SubPrivate Sub sustu_Click()
5、查詢更新學(xué)生信息.ShowEnd SubPrivate Sub xgmm_Click()修改密碼.ShowEnd SubPrivate Sub yhzc_Click()用戶注冊(cè).ShowEnd Sub3、查詢學(xué)生信息代碼:Dim cn As New ADODB.ConnectionDim rst As New ADODB.RecordsetPrivate Sub Command1_Click() Set cn = New ADODB.Connection Set rst = New ADODB.Recordset cn.ConnectionString = "Provider=SQL
6、OLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=students info;Data Source=C1847" cn.Open If Combo1.Text <> "" Then mysql = "select * from 學(xué)生信息表 where 系別='" & Trim(Combo1.Text) & "'" rst.Open mysql, cn If rst.EOF Then MsgBox &quo
7、t;沒(méi)有學(xué)生!", vbOKOnly + vbExclamation, "警告" Combo1.Text = "" Else With MSFlexGrid1 .TextMatrix(0, 1) = "學(xué)號(hào)" .TextMatrix(0, 2) = "姓名" .TextMatrix(0, 3) = "性別" .TextMatrix(0, 4) = "年齡" .TextMatrix(0, 5) = "系別" .TextMatrix(0, 6) =
8、"班級(jí)" MSFlexGrid1.Rows = 1 '每次查詢自動(dòng)定位到第一行 Do While Not rst.EOF .Rows = .Rows + 1 .CellAlignment = 8 .TextMatrix(.Rows - 1, 1) = rst.Fields("學(xué)號(hào)") .TextMatrix(.Rows - 1, 2) = rst.Fields("姓名") .TextMatrix(.Rows - 1, 3) = rst.Fields("性別") .TextMatrix(.Rows - 1,
9、4) = rst.Fields("年齡") .TextMatrix(.Rows - 1, 5) = rst.Fields("系別") .TextMatrix(.Rows - 1, 6) = rst.Fields("班級(jí)") rst.MoveNext Loop End With End If ElseIf Combo2.Text <> "" Then mysql = "select * from 學(xué)生信息表 where 班級(jí)='" & Trim(Combo2.Text)
10、 & "'" rst.Open mysql, cn If rst.EOF Then MsgBox "沒(méi)有學(xué)生!", vbOKOnly + vbExclamation, "警告" Combo1.Text = "" Else With MSFlexGrid1 .TextMatrix(0, 1) = "學(xué)號(hào)" .TextMatrix(0, 2) = "姓名" .TextMatrix(0, 3) = "性別" .TextMatrix(0, 4) =
11、 "年齡" .TextMatrix(0, 5) = "系別" .TextMatrix(0, 6) = "班級(jí)" MSFlexGrid1.Rows = 1 '每次查詢自動(dòng)定位到第一行 Do While Not rst.EOF .Rows = .Rows + 1 .CellAlignment = 8 .TextMatrix(.Rows - 1, 1) = rst.Fields("學(xué)號(hào)") .TextMatrix(.Rows - 1, 2) = rst.Fields("姓名") .TextMa
12、trix(.Rows - 1, 3) = rst.Fields("性別") .TextMatrix(.Rows - 1, 4) = rst.Fields("年齡") .TextMatrix(.Rows - 1, 5) = rst.Fields("系別") .TextMatrix(.Rows - 1, 6) = rst.Fields("班級(jí)") rst.MoveNext Loop End With End If ElseIf Text1.Text <> "" Then mysql =
13、"select * from 學(xué)生信息表 where 學(xué)號(hào)='" & Trim(Text1.Text) & "'" rst.Open mysql, cn If rst.EOF Then MsgBox "沒(méi)有學(xué)生!", vbOKOnly + vbExclamation, "警告" Combo1.Text = "" Else With MSFlexGrid1 .TextMatrix(0, 1) = "學(xué)號(hào)" .TextMatrix(0, 2) =
14、"姓名" .TextMatrix(0, 3) = "性別" .TextMatrix(0, 4) = "年齡" .TextMatrix(0, 5) = "系別" .TextMatrix(0, 6) = "班級(jí)" MSFlexGrid1.Rows = 1 '每次查詢自動(dòng)定位到第一行 Do While Not rst.EOF .Rows = .Rows + 1 .CellAlignment = 8 .TextMatrix(.Rows - 1, 1) = rst.Fields("學(xué)號(hào)&
15、quot;) .TextMatrix(.Rows - 1, 2) = rst.Fields("姓名") .TextMatrix(.Rows - 1, 3) = rst.Fields("性別") .TextMatrix(.Rows - 1, 4) = rst.Fields("年齡") .TextMatrix(.Rows - 1, 5) = rst.Fields("系別") .TextMatrix(.Rows - 1, 6) = rst.Fields("班級(jí)") rst.MoveNext Loop
16、End With End IfElse MsgBox "請(qǐng)輸入查詢條件!", vbOKOnly + vbExclamation, "警告"End IfEnd SubPrivate Sub Command2_Click()Combo1.Text = ""Combo2.Text = ""Text1.Text = ""End SubPrivate Sub Command3_Click()修改學(xué)生信息.ShowEnd Sub '修改學(xué)生信息Private Sub Command4_Click()
17、 Set cn = New ADODB.Connection Set rst = New ADODB.Recordset cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=students info;Data Source=C1847" cn.Open mysql = "delete from 學(xué)生信息表 where 學(xué)號(hào)='" & Text1.Text & "'&qu
18、ot; rst.Open mysql, cn MsgBox "刪除成功!", vbOKOnly + vbExclamation, "警告"End SubPrivate Sub Form_Load()Combo1.AddItem "信息服務(wù)學(xué)院"Combo1.AddItem "電子信息工程系"Combo2.AddItem "40821P"Combo2.AddItem "40811P"Combo2.AddItem "40822P"Combo2.AddItem
19、"40721P"End Sub4、添加學(xué)生信息代碼Dim cn As New ADODB.ConnectionDim rst As New ADODB.RecordsetPrivate Sub Form_Load()Combo1.AddItem "信息服務(wù)學(xué)院"Combo1.AddItem "電子信息工程系"Combo2.AddItem "40821P"Combo2.AddItem "40811P"Combo2.AddItem "40822P"Combo2.AddItem &
20、quot;40721P"End SubPrivate Sub Command1_Click() Set cn = New ADODB.Connection Set rst = New ADODB.Recordset cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=students info;Data Source=C1847" cn.OpenDim sex As String usna = Trim(Text1.Tex
21、t) mysql = "select * from 學(xué)生信息表 where 學(xué)號(hào)='" & usna & "'" rst.Open mysql, cn If rst.EOF Then rst.Close Else rst.Close MsgBox "該學(xué)生信息已存在!", vbOKOnly + vbExclamation, "警告" Text1.Text = "" Text2.Text = "" Text3.Text = ""
22、; Combo1.Text = "" Combo2.Text = "" Option1.Value = False Text1.SetFocus End IfIf Text1.Text = "" Then MsgBox "請(qǐng)輸入學(xué)號(hào)!", vbOKOnly + vbExclamation, "警告" Text1.SetFocus Exit Sub End IfIf Text2.Text = "" Then MsgBox "請(qǐng)輸入姓名!", vbOKOnly
23、 + vbExclamation, "警告" Text2.SetFocus Exit Sub End IfIf Text3.Text = "" Then MsgBox "請(qǐng)輸入年齡!", vbOKOnly + vbExclamation, "警告" Text3.SetFocus Exit Sub End IfIf Option1.Value Then sex = "男" Else sex = "女"End Ifxh = Trim(Text1.Text)xm = Trim(Te
24、xt2.Text)xb = sexnl = Trim(Text3.Text)xofy = Trim(Combo1.Text)bj = Trim(Combo2.Text)mysql = "insert into 學(xué)生信息表(學(xué)號(hào),姓名,性別,年齡,系別,班級(jí)) values ('" & xh & "','" & xm & "','" & xb & "','" & nl & "',&
25、#39;" & xofy & "','" & bj & "')"rst.Open mysql, cnMsgBox ("信息添加成功!") Text1.Text = "" Text2.Text = "" Text3.Text = "" Combo1.Text = "" Combo2.Text = "" Option1.Value = FalseEnd Sub5、修改密碼:D
26、im rst As New ADODB.Recordset Dim cn As New ADODB.ConnectionPrivate Sub Command1_Click() Set cn = New ADODB.Connection Set rst = New ADODB.Recordset cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=students info;Data Source=C1847" cn.Open If
27、 Text1.Text = "" Then MsgBox "請(qǐng)輸入密碼!", vbOKOnly + vbExclamation, "警告" Text1.SetFocus Exit Sub End IfIf Text2.Text = "" Then MsgBox "請(qǐng)輸入新密碼!", vbOKOnly + vbExclamation, "警告" Text2.SetFocus Exit Sub End IfIf Text3.Text = "" Then Msg
28、Box "請(qǐng)確認(rèn)輸入的新密碼!", vbOKOnly + vbExclamation, "警告" Text3.SetFocus Exit Sub End IfIf Text2.Text = Text3.Text Thenxmm = Trim(Text2.Text)mysql = "update 用戶表 set 密碼 = '" & xmm & "' where 用戶名 = '" & 登陸.Text1.Text & "'"rst.Ope
29、n mysql, cnMsgBox ("密修改成功!")End If End SubPrivate Sub Command2_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub6、修改學(xué)生信息代碼:Dim cn As New ADODB.ConnectionDim rst As New ADODB.RecordsetPrivate Sub Command1_Click() Set cn = New ADODB.Connection Set rst
30、= New ADODB.Recordset cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=students info;Data Source=C1847" cn.Open usna = Trim(Text1.Text) mysql = "select * from 學(xué)生信息表 where 學(xué)號(hào)='" & usna & "'" rst.Open mysql,
31、 cn rst.Close mysql = "delete from 學(xué)生信息表 where 學(xué)號(hào)='" & Text1.Text & "'" rst.Open mysql, cnIf Text1.Text = "" Then MsgBox "請(qǐng)輸入學(xué)號(hào)!", vbOKOnly + vbExclamation, "警告" Text1.SetFocus Exit Sub End IfIf Text2.Text = "" Then MsgBox &
32、quot;請(qǐng)輸入姓名!", vbOKOnly + vbExclamation, "警告" Text2.SetFocus Exit Sub End IfIf Text3.Text = "" Then MsgBox "請(qǐng)輸入年齡!", vbOKOnly + vbExclamation, "警告" Text3.SetFocus Exit Sub End IfIf Option1.Value Then sex = "男" Else sex = "女"End Ifxh = T
33、rim(Text1.Text)xm = Trim(Text2.Text)xb = sexnl = Trim(Text3.Text)xofy = Trim(Combo1.Text)bj = Trim(Combo2.Text)mysql = "insert into 學(xué)生信息表(學(xué)號(hào),姓名,性別,年齡,系別,班級(jí)) values ('" & xh & "','" & xm & "','" & xb & "','" &
34、amp; nl & "','" & xofy & "','" & bj & "')"rst.Open mysql, cnMsgBox ("信息修改成功!") Text1.Text = "" Text2.Text = "" Text3.Text = "" Combo1.Text = "" Combo2.Text = "" Option1.V
35、alue = FalseEnd SubPrivate Sub Form_Load()Combo1.AddItem "信息服務(wù)學(xué)院"Combo1.AddItem "電子信息工程系"Combo2.AddItem "40821P"Combo2.AddItem "40811P"Combo2.AddItem "40822P"Combo2.AddItem "40721P"End Sub7、用戶注冊(cè)代碼:Dim rst As New ADODB.Recordset Dim cn As Ne
36、w ADODB.ConnectionPrivate Sub Command1_Click() Set cn = New ADODB.Connection Set rst = New ADODB.Recordset cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=students info;Data Source=C1847" cn.Open If Text1.Text = "" Then MsgBox &qu
37、ot;請(qǐng)輸入用戶名!", vbOKOnly + vbExclamation, "警告" Text1.SetFocus Exit Sub End IfIf Text2.Text = "" Then MsgBox "請(qǐng)輸入密碼!", vbOKOnly + vbExclamation, "警告" Text2.SetFocus Exit Sub End IfIf Text3.Text = "" Then MsgBox "請(qǐng)?jiān)俅屋斎朊艽a!", vbOKOnly + vbExc
38、lamation, "警告" Text3.SetFocus Exit Sub End Ifsryhm = Trim(Text1.Text)srmm = Trim(Text2.Text)mysql = "insert into 用戶表(用戶名,密碼) values ('" & sryhm & "','" & srmm & "')"rst.Open mysql, cnMsgBox ("用戶添加成功!")Text1.Text = &quo
39、t;"Text2.Text = ""Text3.Text = "" End Sub '添加用戶Private Sub Command2_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub '重置按鈕Private Sub Command3_Click() Set cn = New ADODB.Connection Set rst = New ADODB.Recordset cn.ConnectionSt
40、ring = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=students info;Data Source=C1847" cn.Open usna = Trim(Text1.Text) mysql = "select * from 用戶表 where 用戶名='" & usna & "'" rst.Open mysql, cn If rst.EOF Then MsgBox "用戶名可用
41、!" Else MsgBox "用戶名已存在!", vbOKOnly + vbExclamation, "警告" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text1.SetFocus Exit Sub End IfEnd Sub '檢查用戶名Private Sub Command4_Click() Set cn = New ADODB.Connection Set rst = New ADODB.Recordset cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Secu
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年初中生物學(xué)考試試題及答案
- 勞動(dòng)教育融入研學(xué)旅行中的研究
- 市場(chǎng)推廣及市場(chǎng)調(diào)研協(xié)議
- 教學(xué)進(jìn)度管理規(guī)定
- 動(dòng)物王國(guó)的童話讀后感(15篇)
- 2025年采購(gòu)師(初級(jí))考試試卷:采購(gòu)談判與議價(jià)技巧
- 2025年電工中級(jí)職業(yè)技能考試真題卷-電路分析與應(yīng)用試題
- 社區(qū)開(kāi)發(fā)與農(nóng)業(yè)產(chǎn)業(yè)化合作協(xié)議
- 2025年柔印CTP項(xiàng)目規(guī)劃申請(qǐng)報(bào)告模板
- 春節(jié)里的趣事記事類話題作文13篇
- 肢體離斷傷的護(hù)理
- 2024年中國(guó)黑龍江省農(nóng)藥市場(chǎng)調(diào)查報(bào)告
- LINE6效果器HD300中文說(shuō)明書
- 浙江省強(qiáng)基聯(lián)盟學(xué)考模擬2024-2025學(xué)年高二下學(xué)期6月學(xué)考模擬地理試題(含答案)
- 中國(guó)美術(shù)學(xué)院非教學(xué)崗位招聘筆試真題2024
- 外賣餐飲平臺(tái)管理制度
- 人形機(jī)器人深度研究系列八:諧波減速器:差齒傳動(dòng)持續(xù)進(jìn)化
- 公立醫(yī)院風(fēng)險(xiǎn)評(píng)估報(bào)告
- 腫瘤婦科進(jìn)修匯報(bào)
- 麻醉意外與并發(fā)癥處理規(guī)范與流程
- 2025年中考語(yǔ)文作文終極押題(附范文5篇)
評(píng)論
0/150
提交評(píng)論