




已阅读5页,还剩10页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
课程设计报告课程设计题目:工资管理系统 工资管理系统一、实验题目:1) 员工基本信息的管理功能。2) 单位员工变动、奖惩情况的管理功能。3) 工资的计算、修改功能。4) 查询统计功能。5) 报表打印功能。6) 具有数据备份和数据恢复功能。设计要求:在提供员工详细的工资资料的同时,尽量使系统能具一定的安全性和通用性。2、 编程1、主窗口的设计 mdiform1.hideform9.showend subprivate sub mdiform_load()end subprivate sub ss_click() mdiform1.hideform4.showend subprivate sub sss_click() mdiform1.hideform2.showend subprivate sub aa_click() mdiform1.hideform3.showend subprivate sub ssss_click()mdiform1.hideform5.showend subprivate sub sssss_click()mdiform1.hideform6.showend subprivate sub ssssss_click()mdiform1.hideform7.showend subprivate sub sssssss_click()mdiform1.hideform8.showend sub2、登入窗口设计option explicitprivate function selectsql(sql as string) as adodb.recordset 返回adodb.recordset对象 dim connstr as string dim conn as adodb.connection dim rs as adodb.recordset set rs = new adodb.recordset set conn = new adodb.connection on error goto myerr: connstr = provider=sqloledb.1;integrated security=sspi;persist security info=false;initial catalog=teacher;data source=lenovo-pc 这是连接sql数据库的语句conn.open connstr rs.cursorlocation = aduseclient rs.open trim$(sql), conn, adopendynamic, adlockoptimistic set selectsql = rs exit functionmyerr: set rs = nothing set conn = nothing 释放相关的系统资源 msgbox err.description, vbinformation, 系统提示 显示出错信息end functionprivate sub command1_click() dim sql as string dim rs as adodb.recordset if text1.text = then msgbox 请输入口令!, 16 text1.setfocus exit sub end if sql = select * from 系统用户表结构 where 用户名 = & text1.text & and 口令 = & text2.text & and 身份= & combo1.text & objcn, adopenstatic, adlockoptimistic set rs = selectsql(sql) if rs.recordcount 0 then mdiform1.show 想要打开的主窗体 msgbox 登录成功!, 64, 提示 unload me else msgbox 口令不对,请重新输入!, 16, 提示 text1.setfocus end ifend subprivate sub form_load()form1.left = (screen.width - form1.width) / 2form1.top = (screen.height - form1.height) / 23、员工基本信息管理设计private sub command7_click()text1.text = text2.text = text3.text = text4.text = text5.text = combo1.listindex = 4combo2.listindex = 4command5.enabled = truecommand6.enabled = true 在保存新记录之前禁用下述控件command1.enabled = truecommand2.enabled = truecommand3.enabled = truecommand4.enabled = trueend subprivate sub command8_click()dim mno as string mno = inputbox(请输入员工编号, 查找窗) adodc1.recordset.find 员工编号= & mno & , , , 1 if adodc1.recordset.eof then msgbox 无此员工编号, , 提示end subprivate sub command5_click()command1.enabled = falsecommand2.enabled = falsecommand3.enabled = falsecommand4.enabled = falseadodc1.recordset.addnewend subprivate sub command8_click()form2.hidemdiform1.showend subprivate sub command9_click()command1.enabled = falsecommand2.enabled = falsecommand3.enabled = falsecommand4.enabled = falseadodc1.recordset(姓名) = text1.textadodc1.recordset(编号) = text2.textadodc1.recordset(部门) = text3.textadodc1.recordset(有住房) = text4.textadodc1.recordset(专家) = text5.textadodc1.recordset(生日) = text6.textadodc1.recordset(工作时间) = text7.textadodc1.recordset(职称) = combo1.textadodc1.recordset(职务) = combo2.textadodc1.recordset.updatemsgbox (修改成功)end subprivate sub command6_click()command1.enabled = falsecommand2.enabled = falsecommand3.enabled = falsecommand4.enabled = falseif msgbox(确定删除当前记录?, vbquestion + vbyesno, 删除?) = vbyes thenadodc1.recordset.deleteadodc1.recordset.movenextif adodc1.recordset.eof then adodc1.recordset.movelastend ifend subprivate sub command10_click()command1.enabled = falsecommand2.enabled = falsecommand3.enabled = falsecommand4.enabled = falsedim strb() as bytecommondialog1.showopenopen commondialog1.filename for binary as #1f1 = lof(1)redim strb(f1)get #1, , strbadodc1.recordset.fields(照片).appendchunk strbclose #1image1.picture = loadpicture(commondialog1.filename)end subprivate sub command1_click()adodc1.recordset.movefirstend sub private sub command2_click()adodc1.recordset.movepreviousend subprivate sub command3_click()adodc1.recordset.movenextend subprivate sub command4_click()adodc1.recordset.movelastend sub4、用户信息管理设计private sub command1_click()command5.enabled = falsecommand6.enabled = falsecommand7.enabled = falsecommand8.enabled = falseadodc1.recordset(用户名) = text1.textadodc1.recordset(口令) = text2.textadodc1.recordset(身份) = text3.textadodc1.recordset.updatemsgbox (修改成功)end subprivate sub command2_click()command5.enabled = falsecommand6.enabled = falsecommand7.enabled = falsecommand8.enabled = falseadodc1.recordset.addnewend subprivate sub command3_click()command5.enabled = falsecommand6.enabled = falsecommand7.enabled = falsecommand8.enabled = falseif msgbox(确定删除当前记录?, vbquestion + vbyesno, 删除?) = vbyes thenadodc1.recordset.deleteadodc1.recordset.movenextif adodc1.recordset.eof then adodc1.recordset.movelastend ifend subprivate sub command4_click()form4.hidemdiform1.showend subprivate sub command5_click()adodc1.recordset.movefirstend sub private sub command6_click()adodc1.recordset.movepreviousend subprivate sub command7_click()adodc1.recordset.movenextend subprivate sub command8_click()adodc1.recordset.movelastend subprivate sub command9_click()command5.enabled = truecommand6.enabled = truecommand7.enabled = truecommand8.enabled = trueend sub5、工资合算表设计form3.hidemdiform1.showend sub private sub command1_click() dim mno as string mno = inputbox(请输入员工编号, 查找窗)adodc1.recordset.find 编号= & mno & , , , 1text1 = text21.text text3 = text22.text if adodc1.recordset.eof then msgbox 无此员工编号, , 提示adodc4.recordset.find 编号= & mno & , , , 1if adodc4.recordset.eof then msgbox 无此员工编号, , 提示dim m as string m = text1text2.datafield = madodc3.recordset(m) = text2.textdim p as string p = text3text4.datafield = padodc2.recordset(p) = text2.text text15.text = val(text9) + val(text10) + val(text11) + val(text12) + val(text13) + val(text14)text16.text = val(text2) + val(text4) + val(text5) + val(text6) + val(text7) + val(text8) text25.text = val(text16) - val(text15) end sub6、恢复与备份设计public function fbackupdatabase_a(byval sbackupfilename$ _ , byval sdatabasename$ _ , optional byval sisaddbackup as boolean = false _ ) as string private sub command1_click() dim idb as adodb.connection dim iconcstr$, isql$, ireturn$ on error goto lberr 创建对象 set idb = new adodb.connection 连接数据库服务器 iconcstr = provider=sqloledb.1;integrated security=sspi;persist security info=false;initial catalog=teacher;data source=lenovo-pc idb.open iconcstr 生成数据库备份语句 isql = backup database & sdatabasename & & vbcrlf & _ to disk= & sbackupfilename & & vbcrlf & _ with description= & zj-backup at: & date & ( & time & ) & vbcrlf & _ iif(sisaddbackup, , ,init) idb.execute isql goto lbexit lberr: ireturn = errorlbexit: fbackupdatabase_a = ireturnend subpublic function frestoredatabase_a(byval sbackupfilename$ _ , byval sdatabasename$ _ , optional byval sdatabasepath$ = _ , optional byval sbackupnumber& = 1 _ , optional byval sreplaceexist as boolean = false _ ) as string private sub command2_click() dim idb as adodb.connection, ire as adodb.recordset dim iconcstr$, isql$, ireturn$, ii& on error goto lberr 连接数据库服务器 iconcstr = provider=sqloledb.1;integrated security=sspi;persist security info=false;initial catalog=teacher;data source=lenovo-pc idb.open iconcstr 创建对象 set idb = new adodb.connection set ire = new adodb.recordset 得到还原后的数据库存放目录,如果没有指定,存放到sql server的data目录 if sdatabasepath = then isql = select filename from master.sysfiles ire.open isql, idb, adopenkeyset, adlockreadonly isql = ire(0) ire.close sdatabasepath = left(isql, instrrev(isql, ) end if 检查数据库是否存在 if sreplaceexist = false then isql = select 1 from master.sysdatabases where name= & sdatabasename & ire.open isql, idb, adopenkeyset, adlockreadonly if ire.eof = false then ireturn = 数据库已经存在! ire.close goto lbexit end if ire.close end if 关闭用户进程 , 防止其它用户正在使用数据库, 导致数据恢复失败 isql = select spid from master.sysprocesses where dbid=db_id( & sdatabasename & ) ire.open isql, idb, adopenkeyset, adlockreadonly while ire.eof = false isql = kill & ire(0) idb.execute isql ire.movenext wend ire.close 获取数据库恢复信息 isql = restore filelistonly from disk= & sbackupfilename & & vbcrlf & _ with file= & sbackupnumber ire.open isql, idb, adopenkeyset
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 煤矿地面建设施工方案
- 余热利用工三级安全教育(班组级)考核试卷及答案
- 药油肩颈套盒培训课件
- 房地产营销方案名称高级
- 推广渠道效果评估报告
- 线上教学论坛活动方案策划
- 迪庆法律咨询方案
- 儿童摄影活动引流方案策划
- 线上粉丝群营销方案设计
- 双十一睡衣营销方案策划
- 医院2025年度内部控制风险评估报告
- 个人成长经历课件
- 计算机网络基础IP地址TFTP协议NAT配置等知识试卷
- 中考语文一轮复习:标题的含义与作用(学生版)
- T/CAQI 96-2019产品质量鉴定程序规范总则
- 机动车检测工资格证考试题(附答案)
- 护士沟通技巧与人文关怀护理课件
- 2025人教部编版语文四年级上册教学计划(含进度表)
- 模具开发技术协议书
- 冷色暖色美术课件
- 拆除安全合同协议书
评论
0/150
提交评论