版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、主要代码如下:1登录界面代码:dim cn as new adodb.connectiondim rst as new adodb.recordsetprivate sub mand1_click()set cn = new adodb.connectionset rst = new adodb.recordsetstatic i%cn.connectionstring = hprovider=sqloledb.1 persist security lnfo=false;user id=sa;lnitial catalog=students info;data source=c1847mcn.
2、openusna = trim(textl.text)mysql = select * from 用户表 where 用户名=& usna &rst.open mysql, cnif rst.eof thenmsgbox”用户名不存在!”cn.closetextl .text =text2.text =utextl .setfocuselseif trim(rst(密码)=trim(text2.text) then管理界面.showelsei = i + 1lfi3 thenmsgbox 用户名或密码错误! , vbokonly + vbexclamation,做小h警告cn.closetex
3、t2.text =textl .text =textl.setfocuselsemsgbox ”该用户已被锁定! , vbokonly + vbexclamation,告end ifend ifend ifprivate sub mand2_click()end subtextl .text = m,text2.text = m,text3.text =end sub2、管理界面代码:private sub sinsert_click()添加学生信息.showend subprivate sub sselect_click()查询学生信息.showend subprivate sub sust
4、u_click()查询更新学生信息.showend subprivate sub xgmm_click()修改密码.showprivate sub yhzc_click()用户注册.showend sub3、查询学生信息代码:dim cn as new adodb.connectiondim rst as new adodb.recordsetprivate sub mand1_click()set cn = new adodb.connectionset rst = new adodb.recordsetcn.connectionstring = hprovider=sqloledb. 1
5、;persist security lnfo=false;user id=sa;lnitial catalog=students info;data source=c1847hcn.openif bo 1.text ,h thenmysql = mselect * from学生信息表 where 系别&trim(bol.text) & 皿rst.open mysql, cnif rst.eof thenmsgbox 没有学生vbokonly + vbexclamation, 等生bo1.text = elsemsfiexgridl.rows = 1with msfiexgridl.textma
6、trix(o, 1) =u每次查询自动定位到第一行学号”.textmatrix(o, 2)=姓名.textmatrix(o, 3)=性别”.textmatrix(o, 4)=年龄.textmatrix(o, 5)=系别”.textmatrix(o, 6)=班级do while not rst.eof .rows = .rows + 1.cellalignment = 8 .textmatrix(.rows -1,1).textmatrix(.rows -1,2).textmatrix(.rows -1,3).textmatrix(.rows -1,4).textmatrix(.rows -1,
7、5).textmatrix(.rows -1,6)rst.movenextloopend withend ifelself bo2.text thenmysql = hselect * fromtrim(bo2.text) &=rst.fields(学号”)=rst.fields(姓名)=rst.fields(性另)=rst.fields(年龄。=rst.fields(系另)=rst.fields(班级”)学生信息表where班级 小&rst.open mysql, cnif rst.eofthenmsgbox没有学生! vbokonly + vbexclamation,警告bo1.text
8、= ,helsemsfiexgridl.rows = 1with msfiexgridl每次查询自动定位到第一行.textmatrix(o, 1) =m学号”.textmatrix(o, 2)= 姓名”.textmatrix(o, 3)= 性别”.textmatrix(o, 4)= 年龄”.textmatrix(o, 5)= 系别”.textmatrix(o, 6)= do while not rst.eof班级”.rows = .rows + 1 .cellalignment = 8.textmatrix(.rows -1,1) = rst.fields(学号”).textmatrix(.r
9、ows -1,2) = rst.fields。姓名”).textmatrix(.rows -1,3) = rst.fields。性别”).textmatrix(.rows -1,4) = rst.fields。年龄m)系别) 班级h).textmatrix(.rows -1,5) = rst. fields。.textmatrix(.rows -1,6) = rst.fields。 rst.movenextloopend withend ifelself textl.text thenmysql = select * from 学生信息表 where 学号=u, &trim(text1.tex
10、t)&rst.open mysql, cnif rst.eof thenmsg box 没有学生vbokonly + vbexclamation,bo1 .text =elsewith msfiexgridl.textmatrix(o, 1)=学号.textmatrix(o, 2)=姓名”textmatrix(o, 3)=性别”textmatrix(o, 4)=”年龄”textmatrix(o, 5)=系别”textmatrix(o, 6)=”班级”msfiexgridl.rows = 1每次查询自动定位到第一行do while not rst.eof.rows = .rows + 1.cel
11、lalignment = 8.textmatrix(.rows -1,1) =rst.fieldsf学号*).textmatrix(.rows -1,2) =rst.fieldsf姓名*).textmatrix(.rows -1,3) =rst.fieldsf性别*).textmatrix(.rows -1,4) =rst.fields(年龄*).textmatrix(.rows -1,5) =rst.fieldsf系别*).textmatrix(.rows -1,6) =rst.fields(班级”)rst.movenextloopend withend if日semsgbox ”请输入查询
12、条件!”, vbokonly + vbexclamation,end ifend subprivate sub mand2_click()bo1.text = bo2.text =text1.text = end subprivate sub mand3_click()修改学生信息.showend sub ,修改学生信息private sub mand4_click()set cn = new adodb.connectionset rst = new adodb.recordsetcn.connectionstring = nprovider=sqloledb.1 ;persist secu
13、rity lnfo=false;llser id=sa;lnitial catalog=students info;data source=c1847hcn.openmysql = delete from学生信息表 where 学号=& textl.text &rst.open mysql, cnmsgbox 删除成功vbokonly + vbexclamation, 做小 iiend subprivate sub form_load()bo1.additem ”信息服务学院bo1.additem ”电子信息工程系bo2.addltem n40821p bo2.addltem “40811p
14、bo2.addltem 40822p” bo2.addltem ”40721p” end sub4、添加学生信息代码dim cn as new adodb.connectiondim rst as new adodb.recordsetprivate sub form_load() bo1.additem 信息服务学院bo1.additem 电子信息工程系 bo2.addltem 40821p bo2.addltem 40811pbo2.addltem “40822p“ bo2.addltem ”40721p” end subprivate sub mand1_click()if text3.
15、text = thenset cn = new adodb.connectionset rst = new adodb.recordsetcn.connectionstring = provider=sqloledb.persist security lnfo=false;user id=sa;lnitial catalog=students info;data source=c1847ncn.opendim sex as stringusna = trim(textl.text) rst.open mysql, cnmysql = select * from学生信息表where学号=h &
16、usna &if rst.eofthenrst.closeelserst.closemsgbox ”该学生信息已存在!“,vbokonly + vbexclamation,htextl .text = m,text2.text =text3.text =bo1.text = bo2.text =optionl.value = falsetextl.setfocusend ifif textl .text = thenmsgbox ”请输入学号! , vbokonly + vbexclamation, 做小textl.setfocusexit subend ifif text2.text = t
17、hen做小msgbox 请输入姓名! , vbokonly + vbexclamation,|text2.setfocusexit subend ifmsgbox 请输入年龄! , vbokonly + vbexclamation,text3.setfocusexit subend ifif optionl.value thensex 二“男”elsesex 二“女”end ifxh = trim(textl.text) xm = trim(text2.text) xb = sexnl = trim(text3.text) xofy = trim(bol.text) bj = trim(bo2
18、.text)mysql = insert into学生信息表(学号,姓名,性别,年龄,系别,班级) values ( &xh & xm & xb & nl & xofy & bj &rst.open mysql, cnmsgbox (信息添加成功!)textl .text =text2.text =bo1.text = m, bo2.text = m,optionl.value = falseend sub5、修改密码:dim rst as new adodb.recordsetdim cn as new adodb.connectionprivate sub mand1_click()set
19、 cn = new adodb.connectionset rst = new adodb.recordsetcn.openif textl .text = thenmsgbox ”请输入密码! , vbokonly + vbexclamation,textl.setfocusexit subend if做小11if text2.text = thenmsgbox 请输入新密码! , vbokonly + vbexclamation,htext2.setfocusexit subend ifif text3.text = thenmsgbox ”请确认输入的新密码! , vbokonly +
20、vbexclamation,做小ii 警告text3.setfocusexit subend ifif text2.text = text3.text thenmysql = update 用户表 set 密码=,u & xmm & 111 where 用户名=& 登 ffi.textl.text &rst.open mysql, cnmsgbox (密修改成功!)end ifend subprivate sub mand2_click()text1.text = text2.text =text3.text =end sub6、修改学生信息代码:dim cn as new adodb.con
21、nectiondim rst as new adodb.recordsetprivate sub mand1_click()set cn = new adodb.connectionset rst = new adodb.recordsetxmm = trim(text2.text)cn.openusna = trim(textl.text)mysql = select * from 学生信息表 where 学号=& usna & rst.openmysql, cnrst.closemysql = delete from学生信息表 where 字号=& textl.text & 中rst.op
22、en mysql, cnif textl.text = thenmsgbox ”请输入学号! ”, vbokonly + vbexclamation,textl.setfocusexit subend ifif text2.text = thenmsgbox 请输入姓名! , vbokonly + vbexclamation,text2.setfocusend ifif text3.text = hu then做小msgbox 请输入年龄! , vbokonly + vbexclamation,text3.setfocusexit subend ifif optionl.value thens
23、ex = 男elsesex 二 女end ifxh = trim(textl.text)xm = trim(text2.text)xb = sexnl = trim(text3.text)xofy = trim(bol.text)bj = trim(bo2.text)mysql = insert into学生信息表(学号,姓名性别,年龄,系别,班级),h &bj& ,h)hvalues ch &xh& m,h & xm & ,h,m & xb & nl & j & xofy & ,hrst.open mysql, cnmsgbox (信息修改成功!)textl .text =text2.tex
24、t =text3.text =bo1.text = bo2.text =optionl.value = falseend subprivate sub form_load()bo1.addltem”信息服务学院bo1.additem 电子信息工程系”bo2.addltem ”40821p”bo2.addltem h40811phbo2.addltem ”40822p”bo2.addltem ”40721p”end sub7、用户注册代码:dim rst as new adodb.recordsetdim cn as new adodb.connectionprivate sub mand1_c
25、lick()set cn = new adodb.connectionset rst = new adodb.recordsetcn.connectionstring = hprovider=sqloledb. 1 ;persist security lnfo=false;llser id=sa;lnitial catalog=students info;data source二c1847”cn.openif textl .text = thenmsgbox 请输入用户名! , vbokonly + vbexclamation, 做小textl .setfocusexit subend ifl
26、ftext2.text = ,u thenmsgbox 请输入密码! , vbokonly + vbexclamation,text2.setfocusexit subend ifif text3.text = thenmsgbox ”请再次输入密码! , vbokonly + vbexclamation,警告 iitext3.setfocusexit subend ifsryhm = trim(textl.text)srmm = tri m(text2.text)mysql = insert into 用户表(用户名,密码)values ( & sryhm & & srmm &rst.ope
27、n mysql, cnmsgbox (用户添加成功!)textl .text =text2.text =private sub mand2_click()textl .text =text3.text =tex text = ,htext3.text =1,11end sub重置按钮private sub mand3_click()set cn = new adodb.connectionset rst = new adodb.recordsetcn.connectionstring = trovider=sqloledb.1 persist security lnfo=false;llser
28、 id=sa;lnitial catalog=students info;data source=c1847hcn.openusna = trim(textl.text)mysql = select * from 用户表 where 用户名=& usna &rst.open mysql, cnif rst.eof thenmsgbox”用户名可用!else馨牛1imsgbox u 用户名已存在! ”, vbokonly + vbexclamation,htextl .text =text2.text =text3.text =textl .setfocusexit subend ifend sub检查用户名private sub mand4_click()set cn = new adodb.connectionset rst = new adodb.recordsetcn.connectionstring = hprovider=sqloledb. 1 ;persist security lnfo=false;llser id=sa;lnitial catalog=students info;data source=c1847hcn.openusna = t
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026秋季国家管网集团华中公司高校毕业生招聘笔试备考题库(浓缩500题)含答案详解(b卷)
- 2026秋季国家管网集团云南公司高校毕业生招聘考试参考试题(浓缩500题)及参考答案详解(考试直接用)
- 2026秋季国家管网集团东部原油储运公司高校毕业生招聘考试备考试题(浓缩500题)有完整答案详解
- 2026秋季国家管网集团广西公司高校毕业生招聘笔试参考题库(浓缩500题)含答案详解(a卷)
- 2026国网湖北省电力公司高校毕业生提前批招聘笔试参考题库浓缩500题及1套完整答案详解
- 2026秋季国家管网集团广西公司高校毕业生招聘笔试备考试题(浓缩500题)附答案详解(基础题)
- 2025国网福建省高校毕业生提前批招聘(约450人)笔试模拟试题浓缩500题含答案详解(新)
- 2026秋季国家管网集团山东分公司高校毕业生招聘考试备考试题(浓缩500题)及参考答案详解
- 2026年双鸭山市农村信用社联合社秋季校园招聘笔试备考题库(浓缩500题)参考答案详解
- 2026国家管网集团甘肃公司秋季高校毕业生招聘25人笔试参考题库(浓缩500题)附答案详解ab卷
- 2025年价格鉴证师职业能力水平评价考试(法学基础知识与价格政策法规)练习题及答案二
- 小内容趋势报告2025-碎片化时代下的品牌新叙事
- 扦插吊兰课件
- 2025年铁路线路工技能竞赛考试题库(含答案)
- 第8课+溺水的预防与急救+课件+2025-2026学年人教版(2024)初中体育与健康七年级全一册
- 2025年入团考试试题库问答题部分及解析答案
- 2025中国银行考试试题及答案
- 2025管理学原理企业管理试题及答案
- 分拣标准化培训课件
- 2025至2030中国电容膜片真空计行业项目调研及市场前景预测评估报告
- 女装秋冬商品培训
评论
0/150
提交评论