vb工资管理系统(ACCESS版)
- 格式:doc
- 大小:30.50 KB
- 文档页数:6
VB下企业工资数据库系统开发摘要:论文对vb下的企业工资数据库系统开发进行了研究,给出了其应用的重要性,对其功能开发、数据库设计展开了详细的探讨,最后给出了系统的具体实现对该类应用有着良好的借鉴性。
关键词:数据库应用企业工资管理人力资源管理企业管理计算机应用信息系统一、引言同时连接工时考勤和医疗保险等等,来生成企业每个职工的基本工资、津贴、医疗保险、保险费、实际发放工资等。
资金是企业生存的主要元素,资金的流动影响到企业的整体运作,企业员工的工资是企业资金管理的一个重要的组成部分。
vb是一种面向对象的开发工具,具有组件丰富、语言简单、功能强大的优点。
access数据库具有与vb无缝连接、操作简单、易于使用的优点。
应用vb结合数据库技术开发企业工资管理系统,能够有效地提高工作效率,节省人力和物力,最终满足企业财务管理、员工工资发放的需要,同时也成为现代化企业管理的标志。
本文主要就该系统的开发设计展开深入的分析。
二、企业工资管理系统概述企业工资管理是一项琐碎、复杂而又十分细致的工作,一般不允许发生差错。
最初的工资统计和发放都是使用人工方式处理,工作量大的时候,出现错误的几率也随之升高,不仅花费财务人员大量的时间,而且往往由于抄写不慎,或者由于计算的疏忽,出现工资发放错误的现象。
同时工资的发放具有较强的时间限制,必须严格按照单位规定的时间完成计算和发放工作。
正是企业工资管理的这种重复性、规律性、时间性,使得企业工资管理计算机化成为可能。
企业工资管理系统就是使用电脑代替大量的人工统计和计算,完成众多企业工资信息的处理,同时使用电脑还可以安全地、完整地保存大量的企业工资记录。
三、系统功能模块划分开发这个系统的目的就是帮助企业的财务主管部门提高工作效率,实现企业工资信息管理的系统化、规范化和自动化。
能够和认识管理系统、考勤管理系统相结合,真正实现企业高效、科学、现代化的员工管理。
系统最终实现的主要功能如下。
企业工资信息设置部分:包括设置员工的基本工资和其他项目的金额,如奖金等。
ACCESS数据库和VB的连接Edited by Ryan 20131、建立Access数据库2、启动VB,建立标准EXE图13、添加ActiveX控件鼠标指向任意VB控件,单击右键,选择“部件(O)”,出现图3所示界面图2图3选择部件“Microsoft ADO Data Control 6.0 (OLEDB)”,出现如图4所示控件图44、添加控件Adodc图54、在控件Adodc上添加数据源鼠标指向控件Adodc1,单击右键,选择“ADODC 属性”,弹出如图7所示界面图6图7单击“生成(U). . .”,弹出如图8所示界面图8选择“Microsoft Jet 4.0 OLE DB Provider”,单击“下一步(N) >>”,弹出如图9所示界面图9单击“. . .”,添加数据源(第一步所建Access 数据库),如图10所示图10单击“测试连接(T)”,出现提示框,如图11所示图11之后点击“确定”,退回到如图12所示界面图12单击“记录源”,弹出如图13所示界面图13在“命令类型”下,选择“1 - adCmdText”,在“命令文本(SQL)”下,输入“Select * from test1”,最后单击“应用”,“确定”即可之后,进入程序书写部分程序部分需要注意接头形式及简单例子如下:Private Sub Command1_Click() ‘VB按钮控件Dim mydb As New ADODB.Connection ‘定义新的数据库连接mydb.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\read database\test1\test1.mdb" ‘数据库绝对路径Dim rs As New ADODB.Recordset ‘定义数据库的一个对象mydb.Open ‘打开数据库rs.Open "select * from test1", mydb, 3, 3 ‘打开数据库中的表test1For i = 1 To 1 ! For循环控制选择哪一行rs.MoveNextNext iMe.Text1.Text = rs.Fields(1).Value ‘读取指定行中的哪个数据给文本框rs.Update ‘数据显示rs.Close ‘关闭表End Sub。
基于Visual Basic语言的工资管理系统的开发与设计作者:王铁媛来源:《中国管理信息化》2013年第17期[摘要] 本文使用Visual Basic编程语言,开发和设计了工资管理系统。
该系统实现了一般工资管理系统对员工工资信息的浏览、添加、删除、修改和查询功能,能够完成对员工工资的结算,减少大量的人工操作的工作量,降低数据出现错误的概率,加强工资记录的安全性和完整性。
[关键词] 工资管理;VB;设计;开发doi : 10 . 3969 / j . issn . 1673 - 0194 . 2013 . 17. 013[中图分类号] F232 [文献标识码] A [文章编号] 1673 - 0194(2013)17-0026-04企业职工工资关系到每一个职工的切身利益,是保障企业稳健运行的重要环节。
工资核算是所有单位财务部门最基本的业务之一,是一项重要的经常性的工作。
在传统的手工方式下,为了完成工资核算,需要财务人员花费大量的时间和精力,并且在计算过程中非常容易出错。
本文基于Visual Basic语言开发的工资管理系统采用计算机处理,保证了工资核算的准确性和及时性。
1 系统功能与可行性分析工资管理系统的基本功能就是为企业提供工资核算和管理的有关信息,附带提供有关职工个人档案的基本资料,一方面,通过各种资料和计算公式得到每名职工工资数据;另一方面,通过工资分摊将工资分配到各种费用中去。
1.1 系统功能分析为完成工资管理功能,系统应完成的主要功能包括:1.1.1 系统管理系统管理包括操作员管理、权限管理、安全管理等功能,这些功能主要通过操作员编码、姓名、权限以及登录密码等来实现。
1.1.2 档案管理档案管理包括员工信息管理和部门信息管理。
应实现对员工和部门的基本信息的浏览、添加、删除和修改。
(1)基本工资设置:对员工的基本工资信息进行添加、删除和修改。
(2)考勤信息统计:对员工的考勤信息进行添加、删除和修改。
vb数据库操作实例在VB中,我们可以使用ADO(ActiveX Data Objects)来进行数据库操作。
ADO提供了一种统一的方法来访问各种类型的数据源,包括关系型数据库、文本文件、Excel文件等。
下面我们将分别以访问Access数据库和SQL Server数据库为例,介绍一些常见的数据库操作实例。
1. 访问Access数据库Access是一种常用的关系型数据库管理系统,我们可以使用VB来访问和操作Access数据库。
首先,我们需要添加对ADODB的引用,然后创建一个连接对象和一个命令对象。
```vbDim conn As New ADODB.ConnectionDim cmd As New mandconn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;DataSource=C:\path\to\database.accdb"conn.Opencmd.ActiveConnection = connmandType = adCmdTextmandText = "SELECT * FROM TableName"Dim rs As ADODB.RecordsetSet rs = cmd.ExecuteWhile Not rs.EOF'处理数据rs.MoveNextWendrs.Closeconn.Close```上述代码首先创建了一个连接对象`conn`,并设置了连接字符串,这里使用了Access数据库的OLEDB提供程序。
然后创建了一个命令对象`cmd`,并设置了命令的类型和文本。
接着执行了命令,并通过`Recordset`对象`rs`来获取查询结果。
最后使用`While`循环遍历结果集,并对数据进行处理。
2. 访问SQL Server数据库SQL Server是一种常用的关系型数据库管理系统,我们可以使用VB来访问和操作SQL Server数据库。
开题报告课题名称:企业人事工资管理系统一.选题的依据及课题的意义:目前市面上流行的人事管理系统不少。
但是,对于企事业单位的人事管理来说,不需要大型的数据库系统。
只需要一个操作方便,功能实用,能满足本中心对数据的管理及需求的系统。
我们的目标就是开发一个功能实用、操作方便,简单明了的人事管理系统,以满足大多数中小企业的需要。
二.国外研究概况及发展趋势:20世纪80年代后期,进入到数据管理阶段。
该阶段的计算机系统广泛应用于企业管理。
同时工资管理系统已经由原来的人工管理走入了计算机管理的时代,作为信息管理主要工具的数据库已经成为举足轻重的角色。
数据库就是存放数据的仓库,数据按一定的规律存放在计算机中,在科学技术飞速发展的今天人们越来越依赖计算机把现实中的事物抽象成数据然后以记录的形式加以保存。
换个角度看数据库是长期存储在计算机内的,有组织的,可共享的数据集合。
它具有较小的冗余度,较高的系数据独立性和易扩展性等特征,可以让多个用户在不同的权限下使用。
这样用数据库技术来管理工资是一种趋势。
三.研究内容及实验方案;研究内容:本课题的研究内容是对数据库理论及软件工程理论的研究,并利用所学的知识将这些理论运用到实践中来,即用这两大理论开发一套工资管理系统。
这套系统包含以下几个功能模块:1.工资信息设置2 工资信息管理3. 系统其功能模块图如下所示:图一系统功能模块图本人研究的是以下几个功能模块:(1)工资信息设置这个模块的作用是包括设置员工的基本工资和其他项目的金额,如奖金等。
并且负责设置员工工资的计算公式.(2)工资信息管理这个模块包含的信息是包括统计出勤、计算工资、查询工资和导出工资表。
四.目标,主要特色及工作进度目标:在WINDOWS系统下,运用 VB6.0和ACCESS2000数据库进行开发,实现工资管理系统。
主要特色:易操作,外观新颖,界面友好,探索性较强。
工作进度:第14周:收集相关资料,进行系统方案设计,写出开题报告第15周:实现各部分模块功能。
仓库管理系统V B A c c e s s源代码 SANY标准化小组 #QS8QHH-HHGX8Q8-GNHHJ8-HHMHGN#仓库管理系统项目的建立这是本人利用闲暇之余在VB6.0上制作的一个简陋的类库管系统,现图文结合的方式一步一步展现制作过程。
由于本人是个初学者,里面存在很多不足之处望得到高手们的指导。
此文可作供初学者们学习交流。
作者联系方式:E-mail 最终运行效果打开软件出现如下登录界面输入系统预设用户名及密码(11)单击“登录”或单击“新用户”添加新用户进入如下主界面:建立工程1、创建标准EXE2、按“打开”3、添加MDI窗体——打开4、编辑菜单在空白处右击——点击“菜单编辑器”在“标题”里输入“系统”,在“名称”里输入“Sys”(注意此处不能为汉字)点击“下一个”再点击“”“确定”退到MDI界面点击“系统”——“退出”如下,然后编写代码。
代码如下:PrivateSubExit_Click()EndEndSub数据库的建立VB6.0中可以创建Access数据库。
如下建立一个“用户表”的数据库,用来存放用户信息及一些出入库管理信息。
如下图单击“外接程序”再单击“可视化数据管理器”出现如图点击“文件”——“新建”——“MicrosoftAccess”——“Version2.0MDB”输入数据库名,“保存”出现如下图在数据窗口中右击——“新建表”,最终如下往数据表里添加数据在这里就不罗嗦了,请查阅相关书籍。
登录界面窗口的建立最终界面如下:1、Adodc1的添加过程为:单击“工程”——“部件”出现下图所示,选择“控件”下的“MicrosoftADODataControl6.0(OLEDB)”单击“确定”在工具栏中会出现“”图标,单击它并拖动到相应位置即可。
其它元件不在一一说明。
2、本窗体代码如下:PrivateSubCommand1_Click()'“登录”、“确定”按钮IfCommand1.Caption="确定"AndCommand2.Caption="取消"Then'如果为“确定”则添加新用户MsgBox"请输入用户名!",,"登录信息提示:"ExitSubElse'DimusenameAsString'检测用户名是否已经存在DimstrSAsStringusename=Trim(Text1.Text)strS="select*from用户登录信息表where用户名='"&usename&"'" mandType=adCmdTextAdodc1.RecordSource=strSAdodc1.RefreshMsgBox"您输入的用户已存在!",,"登录提示信息:"Text1.Text=""Text2.Text=""Text3.Text=""Text1.SetFocusExitSubEndIfEndIfIfText2.Text=""Then'提示用户密码不能为空MsgBox"密码不能为空!",,"登录提示信息:"Text2.SetFocusExitSubEndIfIfText3.Text=""ThenMsgBox"请再次输入密码!",,"登录提示信息:"Text3.SetFocusExitSubEndIfIfText2.Text<>Text3.TextThenMsgBox"两次输入的密码不一致,请确认!",,"登录提示信息:" Text2.Text=""Text3.Text=""Text2.SetFocusExitSubElseMsgBox("添加新用户成功,现在您可以登陆系统了!")Label3.Visible=FalseText3.Visible=FalseCommand1.Caption="登录"Command2.Caption="退出"EndIfElse'“登录”按钮,用户登录DimstrSnoAsStringDimstrSelectAsStringstrSno=Trim(Text1.Text)'检测用户名是否存在strSelect="select密码from用户登录信息表where用户名='"&strSno&"'" mandType=adCmdTextAdodc1.RecordSource=strSelectAdodc1.RefreshMsgBox"用户名不存在,请重新输入!",,"登录提示信息:"Text1.Text=""Text2.Text=""Text1.SetFocusExitSubEndIfForm1.Hide'UnloadMeForm2.Show'MsgBox"登陆成功!",,"登录提示信息:"ElseMsgBox"密码不正确,请重新输入!",,"登录提示信息:"Text2.Text=""Text2.SetFocusEndIfEndIfEndSubPrivateSubCommand2_Click()'“退出”或“取消”按钮IfCommand2.Caption="取消"ThenLabel3.Visible=FalseText3.Visible=FalseCommand1.Caption="登录"Command2.Caption="退出"Text1.Text=""Text2.Text=""Text1.SetFocusElseEnd'UnloadMeEndIfEndSubPrivateSubCommand3_Click()'“新用户”按钮Label3.Visible=TrueText3.Visible=TrueText1.Text=""Text2.Text=""Text3.Text=""Command1.Caption="确定"Command2.Caption="取消"Text1.SetFocusEndSubPrivateSubCommand3_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle) Label6.Visible=TrueEndSubPrivateSubCommand3_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle) Label6.Visible=FalseEndSubPrivateSubForm_Load()Label3.Visible=FalseText3.Visible=FalseEndSubPrivateSubTimer1_Timer()'时间time1控件的time事件代码,用来'显示向左移动的欢迎字幕IfLabel4.Left+Label4.Width>0Then'当标签右边位置大于0时,标签向左移Else'否则标签从头开始Label4.Left=Form1.ScaleWidthEndIfIfLabel5.Left+Label5.Width>0ThenElseLabel5.Left=Form1.ScaleWidthEndIfEndSub主界面窗体如下:代码:PrivateSubAddNew_Click()Frame1.Visible=TrueFrame2.Visible=FalseEndSubPrivateSubCHKPMCHX_Click()Frame2.Caption="出库信息"DimpmAsStringDimnAsStringpm=InputBox("产品名","请输入",0)n="select*from出库表where品名='"&pm&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid1EndSubPrivateSubCHKXHCHX_Click()Frame2.Caption="出库信息"DimXHAsStringDimnAsStringXH=InputBox("产品型号","请输入",0)n="select*from出库表where型号='"&XH&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshEndSubPrivateSubCKCZ_Click()'Form2.HideForm6.ShowEndSubPrivateSubCKJSHR_Click()Frame2.Caption="出库信息"DimJSHRAsStringDimnAsStringJSHR=InputBox("经手人","请输入",0)n="select*from出库表where经手人='"&JSHR&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid1EndSubPrivateSubCKSHJ_Click()Frame2.Caption="出库信息"DimCHKRQAsStringDimnAsStringCHKRQ=InputBox("出库日期,格式为:月/日/年如:12/1/2011","请输入",0) n="select*from出库表where出库日期='"&CHKRQ&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid1EndSubPrivateSubCKZCX_Click()Frame2.Caption="出库信息"DimZBAsStringZB="select*from出库表"mandType=adCmdTextAdodc2.RecordSource=ZBAdodc2.RefreshCallInitGrid1EndSubPrivateSubCommand1_Click()IfText1.Text=""Then'提示用户输入用户名MsgBox"请输入用户名!",,"登录信息提示:"ExitSubElse'DimusenameAsString'检测用户名是否已经存在DimstrSAsStringusename=Trim(Text1.Text)strS="select*from用户登录信息表where用户名='"&usename&"'"mandType=adCmdTextAdodc1.RecordSource=strSAdodc1.RefreshMsgBox"您输入的用户已存在!",,"登录提示信息:"Text1.Text=""Text2.Text=""Text3.Text=""Text1.SetFocusExitSubEndIfEndIfIfText2.Text=""Then'提示用户密码不能为空MsgBox"密码不能为空!",,"登录提示信息:"Text2.SetFocusExitSubEndIfIfText3.Text=""ThenMsgBox"请再次输入密码!",,"登录提示信息:"Text3.SetFocusExitSubEndIfIfText2.Text<>Text3.TextThenMsgBox"两次输入的密码不一致,请确认!",,"登录提示信息:"Text2.Text=""Text3.Text=""Text2.SetFocusExitSubElseeDimXAsIntegerX=MsgBox("成功添加新用户,是否要重新登录!",vbYesNo+vbQuestion+vbDefaultButton1,"提示信息!") IfX=vbYesThenUnloadMeForm3.ShowEndIf'MsgBox("成功添加新用户!")'Label3.Visible=False'Text3.Visible=False'Command1.Caption="登录"'Command2.Caption="退出"EndIfFrame1.Visible=FalseFrame2.Visible=TrueText1.Text=""Text2.Text="'"Text3.Text=""'Form3.ShowEndSubPrivateSubCommand2_Click() Frame1.Visible=FalseFrame2.Visible=TrueEndSubPrivateSubCXDL_Click()Form3.Show'UnloadMeEndSubPrivateSubExit_Click()EndUnloadForm1UnloadForm2UnloadForm3UnloadForm4UnloadForm5UnloadForm6UnloadForm7UnloadForm8EndSubPrivateSubForm_Load() UnloadForm1Frame1.Visible=False CallInitGrid0Me.Height=MDIForm1.Height-1060 Me.Width=MDIForm1.Width-560 Me.Top=MDIForm1.TopMe.Left=MDIForm1.LeftEndSubPrivateSubGHCZ_Click()'Form2.HideForm8.ShowEndSubFrame2.Caption="归还信息"DimpmAsStringDimnAsStringpm=InputBox("产品名","请输入",0)n="select*from归还表where品名='"&pm&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubGHRCX_Click()Frame2.Caption="归还信息"DimJCRAsStringDimnAsStringJCR=InputBox("归还人","请输入",0)n="select*from归还表where归还人='"&JCR&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubGHSJCX_Click()Frame2.Caption="归还信息"DimJCRQAsStringDimnAsStringJCRQ=InputBox("归还日期,格式为:月/日/年如:12/1/2011","请输入",0) n="select*from归还表where归还日期='"&JCRQ&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubGHXHCX_Click()Frame2.Caption="归还信息"DimXHAsStringDimnAsStringXH=InputBox("产品型号","请输入",0)n="select*from归还表where型号='"&XH&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubFrame2.Caption="归还信息"DimZBAsStringZB="select*from归还表"mandType=adCmdTextAdodc2.RecordSource=ZBAdodc2.RefreshCallInitGrid2EndSubPrivateSubJCCZ_Click()'Form2.HideForm7.ShowEndSubPrivateSubJCHPMCHX_Click()Frame2.Caption="借出信息"DimpmAsStringDimnAsStringpm=InputBox("产品名","请输入",0)n="select*from借出表where品名='"&pm&"'" mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubJCHXHCHX_Click()Frame2.Caption="借出信息"DimXHAsStringDimnAsStringXH=InputBox("产品型号","请输入",0)n="select*from借出表where型号='"&XH&"'" mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubJCRCX_Click()Frame2.Caption="借出信息"DimJCRAsStringDimnAsStringJCR=InputBox("借出人","请输入",0)n="select*from借出表where借出人='"&JCR&"'" mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubJCSHJCX_Click()Frame2.Caption="借出信息"DimJCRQAsStringDimnAsStringJCRQ=InputBox("借出日期,格式为:月/日/年如:12/1/2011","请输入",0) n="select*from借出表where借出日期='"&JCRQ&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubJCZCX_Click()Frame2.Caption="借出信息"DimZBAsStringZB="select*from借出表"mandType=adCmdTextAdodc2.RecordSource=ZBAdodc2.RefreshCallInitGrid2EndSubPrivateSubJSHRCHX_Click()Frame2.Caption="归还信息"DimJSHRAsStringDimnAsStringJSHR=InputBox("经手人","请输入",0)n="select*from归还表where经手人='"&JSHR&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubJSHRCX_Click()Frame2.Caption="借出信息"DimJSHRAsStringDimnAsStringJSHR=InputBox("经手人","请输入",0)n="select*from借出表where经手人='"&JSHR&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid2EndSubPrivateSubPMCX_Click()Frame2.Caption="库存信息"DimpmAsStringDimnAsStringpm=InputBox("产品名","请输入",0)n="select*from库存表where品名='"&pm&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid0EndSubPrivateSubRKCZ_Click()'Form2.HideForm5.ShowEndSubPrivateSubRKJSHR_Click()Frame2.Caption="入库信息"DimJSHRAsStringDimnAsStringJSHR=InputBox("经手人","请输入",0)n="select*from入库表where经手人='"&JSHR&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid1EndSubPrivateSubRKPMCHX_Click()Frame2.Caption="入库信息"DimpmAsStringDimnAsStringpm=InputBox("产品名","请输入",0)IfLen(pm)>0Thenn="select*from入库表where品名='"&pm&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshEndIfCallInitGrid1EndSubPrivateSubRKSHJ_Click()Frame2.Caption="入库信息"DimRKRQAsStringDimnAsStringRKRQ=InputBox("入库日期,格式为:月/日/年如:12/1/2011","请输入",0)n="select*from入库表where入库日期='"&RKRQ&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshCallInitGrid1EndSubPrivateSubRKXHCHX_Click()Frame2.Caption="入库信息"DimXHAsStringDimnAsStringXH=InputBox("产品型号","请输入",0)IfLen(XH)>0Thenn="select*from入库表where型号='"&XH&"'"mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshEndIfCallInitGrid1EndSubPrivateSubRKZCX_Click()Frame2.Caption="入库信息"DimZBAsStringZB="select*from入库表"mandType=adCmdTextAdodc2.RecordSource=ZBAdodc2.RefreshCallInitGrid1EndSubPrivateSubTimer1_Timer()IfLabel4.Left+Label4.Width>0Then'当标签右边位置大于0时,标签向左移Else'否则标签从头开始Label4.Left=Form2.ScaleWidthEndIfIfLabel5.Left+Label5.Width>0ThenElseLabel5.Left=Form2.ScaleWidthEndIfIfLabel6.Left+Label6.Width>0ThenElseLabel6.Left=Form2.ScaleWidthEndIfIfLabel7.Left+Label7.Width>0ThenElseLabel7.Left=Form2.ScaleWidthEndIfEndSubPrivateSubXGMM_Click()'Form2.HideForm4.ShowEndSubPrivateSubXHCX_Click()Frame2.Caption="库存信息"DimXHAsStringDimnAsStringXH=InputBox("产品型号","请输入",0)IfLen(XH)>0Then'AndVal(XH)<>0n="select*from库存表where型号='"&XH&"'" mandType=adCmdTextAdodc2.RecordSource=nAdodc2.RefreshEndIfCallInitGrid0EndSubPrivateSubZB_Click()Frame2.Caption="库存信息"DimZBAsString'DimNAsString'PM=InputBox("产品名","请输入",0)ZB="select*from库存表"'where品名='"&PM&"'" mandType=adCmdTextAdodc2.RecordSource=ZBAdodc2.RefreshCallInitGrid0EndSubPrivateSubInitGrid0()WithDataGrid1.Columns(0).Width=1600.Columns(1).Width=2200.Columns(2).Width=2200.Columns(3).Width=1000.Columns(4).Width=1000.Columns(5).Width=4000EndWithEndSubPrivateSubInitGrid1()WithDataGrid1.Columns(0).Width=800.Columns(1).Width=1600.Columns(2).Width=1600.Columns(3).Width=800.Columns(4).Width=800.Columns(5).Width=1000.Columns(6).Width=800.Columns(7).Width=4000EndWithEndSubPrivateSubInitGrid2()WithDataGrid1'.Columns(0).Caption="学号"'.Columns(1).Caption="课程名"'.Columns(2).Caption="学分"'.Columns(3).Caption="成绩"'设置DtgCond的列宽.Columns(0).Width=800.Columns(1).Width=1600.Columns(2).Width=1600.Columns(3).Width=800.Columns(4).Width=800.Columns(5).Width=800.Columns(6).Width=1000.Columns(7).Width=800.Columns(8).Width=4000EndWithEndSub用户重新登录界面代码:PrivateSubCommand1_Click()DimstrSnoAsStringDimstrSelectAsStringstrSno=Trim(Text1.Text)'检测用户名是否存在strSelect="select密码from用户登录信息表where用户名='"&strSno&"'" mandType=adCmdTextAdodc1.RecordSource=strSelectAdodc1.RefreshMsgBox"用户名不存在,请重新输入!",,"登录提示信息:"Text1.Text=""Text2.Text=""Text1.SetFocusEndIfUnloadMeForm2.Show'MsgBox"登陆成功!",,"登录提示信息:"ElseMsgBox"密码不正确,请重新输入!",,"登录提示信息:"Text2.Text=""Text2.SetFocusEndIfEndSubPrivateSubCommand2_Click()UnloadMeForm2.ShowEndSub修改用户密码界面代码:PrivateSubCommand1_Click()IfTrim(Text1.Text)<>Form2.TextUserNameThenMsgBox"用户名不正确,请确认!",,"信息提示!"Text1.Text=""Text1.SetFocusExitSubElseDimnameAsStringDimnamesAsStringname=Trim(Text1.Text)names="select*from用户登录信息表where用户名='"&name&"'" mandType=adCmdTextAdodc1.RecordSource=namesAdodc1.RefreshIfText2.Text=""ThenMsgBox"请输入旧密码!",,"信息提示!"Text2.SetFocusExitSubEndIfMsgBox"旧密码不正确,请确认!",,"信息提示!"Text2.Text=""Text2.SetFocusExitSubEndIfIfText3.Text=""ThenMsgBox"请输入新密码!",,"信息提示!"Text3.SetFocusEndIfIfText4.Text=""ThenMsgBox"请再次输入新密码!",,"信息提示!"Text4.SetFocusExitSubEndIfIfTrim(Text3.Text)<>Trim(Text4.Text)ThenMsgBox"两次输入的新密码不一致!",,"信息提示!"Text3.Text=""Text4.Text=""Text3.SetFocusExitSubElseMsgBox("密码修改成功!")UnloadMe'Form2.ShowEndIfEndIfEndSubPrivateSubCommand2_Click()UnloadMe'Form2.ShowEndSub入库管理代码:PrivateSubCommand1_Click()IfText1.Text=""AndText2.Text=""ThenMsgBox"“品名”和“型号”不能同时为空,必须输入其中一项!",,"提示信息!" ExitSubText1.SetFocusElseIfText3.Text=""AndText4.Text=""ThenMsgBox"请输入产品“数量”或“单位”之一!",,"提示信息!"Text3.SetFocusExitSubEndIfIfText5.Text=""ThenMsgBox"请经手人签名!",vbCritical,"提示信息!"Text5.SetFocusExitSubEndIfAdodc1.RefreshEndIfDimpmAsStringDimpmsAsStringDimnAsStringDimmAsStringpm=Trim(Text1.Text)n=Val(Text3.Text)pms="select*from库存表where品名='"&pm&"'"WithForm2EndWithElseEndIfEndIfDimXAsIntegerX=MsgBox("产品入库登记成功,是否继续添加产品!",vbYesNo+vbQuestion+vbDefaultButton1,"提示信息!") IfX=vbNoThenUnloadMe'Form2.ShowElseText1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""Text5.Text=""Text6.Text=""Text7.Text=""Text1.SetFocusEndIfDimZBAsStringZB="select*from入库表"'where品名='"&PM&"'"EndSubPrivateSubCommand2_Click()Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""Text5.Text=""Text6.Text=""Text7.Text=""Text1.SetFocusEndSubPrivateSubCommand3_Click()UnloadMe'Form2.ShowEndSub出库管理代码:PrivateSubCommand1_Click()IfCombo1.Text=""AndCombo2.Text=""Then'text1.Text=""AndText2.Text=""ThenMsgBox"“品名”和“型号”不能同时为空,必须输入其中一项!",,"提示信息!"ExitSubElseIfText1.Text=""AndCombo3.Text=""Then'Text4.Text=""ThenMsgBox"请输入产品“数量”或“单位”之一!",,"提示信息!"Text2.SetFocusExitSubEndIfIfText2.Text=""ThenMsgBox"请经手人签名!",vbCritical,"提示信息!"Text2.SetFocusExitSubEndIfAdodc1.RefreshEndIfDimpmAsStringDimpmsAsStringDimnAsStringDimmAsStringpm=Trim(Combo1.Text)n=Val(Text1.Text)pms="select*from库存表where品名='"&pm&"'"EndIfDimXAsIntegerX=MsgBox("产品出库登记成功,是否继续添加产品!",vbYesNo+vbQuestion+vbDefaultButton1,"提示信息!") IfX=vbNoThenUnloadMe'Form2.ShowEndIfCombo1.Text=""Combo2.Text=""Combo3.Text=""Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""DimZBAsStringZB="select*from出库表"'where品名='"&PM&"'"EndSubPrivateSubCommand2_Click()Combo1.Text=""Combo2.Text=""Combo3.Text=""Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""EndSubPrivateSubCommand3_Click()UnloadMe'Form2.ShowEndSubPrivateSubForm_Load()Adodc2.RefreshLoopEndSub借出管理代码:PrivateSubCommand1_Click()IfCombo1.Text=""AndCombo2.Text=""Then'text1.Text=""AndText2.Text=""Then MsgBox"“品名”和“型号”不能同时为空,必须输入其中一项!",,"提示信息!" ExitSubElseIfText1.Text=""AndCombo3.Text=""Then'Text4.Text=""ThenMsgBox"请输入产品“数量”或“单位”之一!",,"提示信息!"Text1.SetFocusExitSubEndIfIfText2.Text=""ThenMsgBox"请经手人签名!",vbCritical,"提示信息!"Text2.SetFocusExitSubEndIfAdodc1.RefreshEndIfDimpmAsStringDimpmsAsStringDimnAsStringDimmAsStringpm=Trim(Combo1.Text)n=Val(Text1.Text)pms="select*from库存表where品名='"&pm&"'"EndIfDimXAsIntegerX=MsgBox("产品借出登记成功,是否继续添加产品!",vbYesNo+vbQuestion+vbDefaultButton1,"提示信息!") IfX=vbNoThenUnloadMeForm2.ShowEndIfCombo1.Text=""Combo2.Text=""Combo3.Text=""Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""DimZBAsStringZB="select*from借出表"'where品名='"&PM&"'"EndSubPrivateSubCommand2_Click()Combo1.Text=""Combo2.Text=""Combo3.Text=""Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""EndSubPrivateSubCommand3_Click()UnloadMeForm2.ShowEndSubPrivateSubForm_Load()Adodc2.RefreshLoopEndSub归还管理代码:PrivateSubCommand1_Click()IfCombo1.Text=""AndCombo2.Text=""Then'text1.Text=""AndText2.Text=""ThenMsgBox"“品名”和“型号”不能同时为空,必须输入其中一项!",,"提示信息!"ExitSubElseIfText1.Text=""AndCombo3.Text=""Then'Text4.Text=""ThenMsgBox"请输入产品“数量”或“单位”之一!",,"提示信息!"Text1.SetFocusExitSubEndIfIfText2.Text=""ThenMsgBox"请经手人签名!",vbCritical,"提示信息!"Text2.SetFocusExitSubEndIfIfText3.Text=""ThenMsgBox"请输入归还人姓名!",vbCritical,"提示信息!"Text3.SetFocusExitSubEndIfAdodc1.RefreshEndIfDimpmAsStringDimpmsAsStringDimnAsStringDimmAsStringpm=Trim(Combo1.Text)n=Val(Text1.Text)pms="select*from库存表where品名='"&pm&"'"EndIfDimXAsIntegerX=MsgBox("产品归还登记成功,是否继续添加产品!",vbYesNo+vbQuestion+vbDefaultButton1,"提示信息!") IfX=vbNoThenUnloadMeForm2.ShowEndIfCombo1.Text=""Combo2.Text=""Combo3.Text=""Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""DimZBAsStringZB="select*from归还表"'where品名='"&PM&"'"EndSubPrivateSubCommand2_Click()Combo1.Text=""Combo2.Text=""Combo3.Text=""Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""EndSubPrivateSubCommand3_Click()UnloadMeForm2.ShowEndSubPrivateSubForm_Load()'DimiAsString'i=0'Adodc2.Refresh'i=i+1'LoopCallpmEndSubPrivateSubpm()DimiAsVariantDimjAsVariantDimkAsVariantDimaAsVariantDimbAsVariantDimcAsVariantDimsAsVariantDimDAsVarianti=0j=0Adodc2.Refreshi=i+1LoopD=Split(a,",")Ifj<iThens=D(2)Combo1.AddItems'k=0'Ifk<jAndD(k)<>D(j)Then'IfD(k)<>D(j)Then'Combo1.AddItemD(j)'k=k+1'Else'k=k+1'EndIf'EndIfj=j+1EndIfText5.Text=s'a+","+D(2)+D(1)'+""+Val(i)+""+Val(j)+""+Val(k) Text6.Text=j'Combo1.AddItemD(1) EndSub。
目录前言 (1)1概述 (3)1.1选用开发语言简介 (3)1.1.1 Microsoft Visual Basic 6.0 介绍 (3)1.1.2 Microsoft Visual Basic 6.0 的编程环境 (4)1.1.3 Visual Basic 6.0的新功能及新的语言特征 (9)1.1.4 VB的ODBC的访问机制 (10)1.1.5 VB 6.0访问开放性数据库的原则和方法 (15)1.1.6 VB 6.0访问开放性数据库几种方法的比较 (16)1.2系统所需环境 (18)2需求分析阶段 (18)2.1系统功能模块 (18)2.2系统数据分析 (18)2.3系统的逻辑模型 (18)3设计阶段 (19)3.1概要设计 (19)3.1.1数据库概论及SQL简介 (19)3.1.2系统数据库的设计 (25)3.2详细设计 (25)3.2.1HIPO图 (25)3.2.2程序流程图 (25)3.2.3窗体功能简介 (25)4设计思想 (25)4.1面向对象的程序设计 (25)4.2详细设计思想 (26)5测试和维护 (26)5.1系统测试平台简介 (26)5.2测试方法 (27)5.3系统维护 (27)6结束语 (28)参考文献 (30)致谢 (31)附:译文 (32)原文 (44)前言20世纪,随着全球经济的蓬勃发展,众多经济学家纷纷提出了新的管理理论。
20世纪50年代,西蒙提出管理依赖于信息和决策的思想。
同时期的维纳发表了控制论,他认为管理是一个控制过程。
1958年,盖尔写到:“管理将以较低的成本得到及时准确的信息,做到较好的控制”。
这个时期,计算机开始用于会计工作。
数据处理一词已经出现。
管理信息系统起初应用于最基础的工作,如打印报表、计算工资、人事管理等,进而发展到企业财务管理、库存管理等单项业务管理,这属于电子数据处理(EDP,Electronic Data Processing)系统。
1 系统背景我国的计算机应用于学校等事业单位的管理,只是在20世纪90年代末期以后才逐渐开展起来的。
目前,计算机辅助管理已在我国的各行各业得到了广泛地应用,但总的来说,计算机在我国事业单位管理中的应用,还处于初级阶段,尤其是计算机辅助管理仅是近几年才在我国得到普及和发展,因此对这方面的研究是必要的,它将推动我国事业单位的发展和管理信息处理的现代化。
1.1 系统目标利用计算机快速整理、传输、处理各种数据的特点,处理会计业务,从而更为全面、更为准确的提供管理、决策所需的财务信息,并可快速查询职工的个人基本信息以及工资的各项信息。
1.2 系统功能包含信息查询,信息维护和统计报表三个功能。
信息查询涵盖了职工个人基本信息,工资项目信息,职工工资信息等。
信息维护功能为管理者提供了快速添加,删除,查询等信息维护和管理的途径,保证信息真实有效。
统计报表可以实现对各类信息的分类分析,汇总统计等,管理人员可以随时全面了解各种相关信息,快速有效地作出决策。
1.3 系统信息职工个人基本信息(职工代码,职工姓名,部门),工资信息(工资,缺勤电费扣款,房费,附加工资,工资汇总)。
1.4 系统环境本系统是在Visuai Basic 上开发的,因而只要求基本的操作系统运行环境。
在Windows XP及以上系统下均能应用。
2 系统概述2.1现状分析计算机工资管理现在我国已积累了一定的理论基础,并且有了较为成熟的经验,但大多数的事业管理系统都应用于普通事业单位科室的办公管理,一般在工资之间的应用程度就相对较低,许多事业单位还处于半手工操作阶段。
从制订单位计划,到工作安排、时间编排,从对教职员工的工作任务下达到教职员工的工作量核算以及考勤管理、考核管理,很多工作都是由管理人员笔抄、手工整理或通过计算器辅助完成,不仅速度慢,浪费了大量人力物力财力,而且极其容易出错,同时不容易进行查询,经常会出现信息不一致的现象。
2.2目标分析本系统开发的目的一方面从提高人事工资管理工作的效率出发,摆脱过去由人用纸和笔进行的费时费力的繁重工作,如何通过设计一个切实可行的软件系统用于解决人事工资管理中信息处理总量大、内容繁多、手段落后的现状,即利用成熟的计算机系统来实现人事工资管理工作的自动化。
精心整理仓库管理系统项目的建立这是本人利用闲暇之余在VB6.0上制作的一个简陋的类库管系统,现图文结合的方式一步一步展现制作过程。
由于本人是个初学者,里面存在很多不足之处望得到高手们的指导。
此文可作供初学者们学习交流。
作者联系方式:E-mail1、2、3、4、EndVB6.0中可以创建Access数据库。
如下建立一个“用户表”的数据库,用来存放用户信息及一些出入库管理信息。
如下图单击“外接程序”再单击“可视化数据管理器”出现如图点击“文件”——“新建”——“Microsoft Access”——“Version 2.0 MDB”输入数据库名,“保存”出现如下图在数据窗口中右击——“新建表”,最终如下往数据表里添加数据在这里就不罗嗦了,请查阅相关书籍。
登录界面窗口的建立最终界面如下:1、Adodc1的添加过程为:单击“工程”——“部件”出现下图所示,选择“控件”下的“Microsoft ADO Data Control 6.0 (OLEDB)”单击“确定”在工具栏中会出现“”图标,单击它并拖动到相应位置即可。
其它元件不在一一说明。
2、本窗体代码如下:Private Sub Command1_Click() '“登录”、“确定”按钮If Command1.Caption = "确定" And Command2.Caption = "取消" Then '如果为“确定”则添加新用户If Text1.Text = "" Then '提示用户输入用户名MsgBox "请输入用户名!", , "登录信息提示:"Exit SubElse 'Dim usename As String '检测用户名是否已经存在Dim strS As Stringusename = Trim(Text1.Text)strS = "select * from 用户登录信息表 where 用户名='" & usename & "'"mandType = adCmdTextAdodc1.RecordSource = strSAdodc1.RefreshMsgBox "您输入的用户已存在!", , "登录提示信息:"Text1.Text = ""Text2.Text = ""Text3.Text = ""Text1.SetFocusExit SubEnd IfEnd IfIf Text2.Text = "" Then '提示用户密码不能为空MsgBox "密码不能为空!", , "登录提示信息:"Text2.SetFocusExit SubEnd IfIf Text3.Text = "" ThenMsgBox "请再次输入密码!", , "登录提示信息:"Text3.SetFocusExit SubEnd IfIf Text2.Text <> Text3.Text ThenMsgBox "两次输入的密码不一致,请确认!", , "登录提示信息:"Text2.Text = ""Text3.Text = ""Exit SubElseMsgBox ("添加新用户成功,现在您可以登陆系统了!")Label3.Visible = FalseText3.Visible = FalseCommand1.Caption = "登录"Command2.Caption = "退出"End IfElse '“登录”按钮,用户登录 Dim strSno As StringDim strSelect As StringText3.Visible = FalseCommand1.Caption = "登录"Command2.Caption = "退出"Text1.Text = ""Text2.Text = ""Text1.SetFocusElseEnd 'Unload MeEnd IfPrivate Sub Command3_Click() '“新用户”按钮 Label3.Visible = TrueText3.Visible = TrueText1.Text = ""Text2.Text = ""Text3.Text = ""Command1.Caption = "确定"Command2.Caption = "取消"Text1.SetFocusEnd SubPrivate Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)如下:代码:Private Sub AddNew_Click()Frame1.Visible = TrueFrame2.Visible = FalseEnd SubPrivate Sub CHKPMCHX_Click()Frame2.Caption = "出库信息"pm = InputBox("产品名", "请输入", 0)n = "select * from 出库表 where 品名 = '" & pm & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid1End SubPrivate Sub CHKXHCHX_Click()Frame2.Caption = "出库信息"Dim XH As StringDim n As StringCHKRQ = InputBox("出库日期,格式为:月/日/年如:12/1/2011", "请输入", 0) n = "select * from 出库表 where 出库日期 = '" & CHKRQ & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid1End SubPrivate Sub CKZCX_Click()ZB = "select * from 出库表 "mandType = adCmdTextAdodc2.RecordSource = ZBAdodc2.RefreshCall InitGrid1End SubPrivate Sub Command1_Click()If Text1.Text = "" Then '提示用户输入用户名 MsgBox "请输入用户名!", , "登录信息提示:"Exit SubEnd IfIf Text2.Text <> Text3.Text ThenMsgBox "两次输入的密码不一致,请确认!", , "登录提示信息:"Text2.Text = ""Text3.Text = ""Text2.SetFocusExit SubElseeX = MsgBox("成功添加新用户,是否要重新登录!", vbYesNo + vbQuestion + vbDefaultButton1, "提示信息!") If X = vbYes ThenUnload MeForm3.ShowEnd If'MsgBox ("成功添加新用户!")'Label3.Visible = False'Text3.Visible = False'Command1.Caption = "登录"'Command2.Caption = "退出"End IfEndEnd SubPrivate Sub Form_Load()Unload Form1Frame1.Visible = FalseCall InitGrid0Me.Height = MDIForm1.Height - 1060Me.Width = MDIForm1.Width - 560Me.Top = MDIForm1.TopMe.Left = MDIForm1.LeftPrivate Sub GHCZ_Click()'Form2.HideForm8.ShowEnd SubPrivate Sub GHPMCX_Click()Frame2.Caption = "归还信息"Dim pm As StringDim n As Stringpm = InputBox("产品名", "请输入", 0)n = "select * from 归还表 where 品名 = '" & pm & "'" mandType = adCmdTextEnd SubPrivate Sub GHXHCX_Click()Frame2.Caption = "归还信息"Dim XH As StringDim n As StringXH = InputBox("产品型号", "请输入", 0)n = "select * from 归还表 where 型号 = '" & XH & "'" mandType = adCmdTextAdodc2.RecordSource = nPrivate Sub GHZCX_Click()Frame2.Caption = "归还信息"Dim ZB As StringZB = "select * from 归还表 "mandType = adCmdTextAdodc2.RecordSource = ZBAdodc2.RefreshCall InitGrid2End SubEnd SubPrivate Sub JCRCX_Click()Frame2.Caption = "借出信息"Dim JCR As StringDim n As StringJCR = InputBox("借出人", "请输入", 0)n = "select * from 借出表 where 借出人 = '" & JCR & "'" mandType = adCmdTextAdodc2.RecordSource = nPrivate Sub JCSHJCX_Click()Frame2.Caption = "借出信息"Dim JCRQ As StringDim n As StringJCRQ = InputBox("借出日期,格式为:月/日/年如:12/1/2011", "请输入", 0) n = "select * from 借出表 where 借出日期 = '" & JCRQ & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshDim n As StringJSHR = InputBox("经手人", "请输入", 0)n = "select * from 借出表 where 经手人 = '" & JSHR & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub PMCX_Click()Dim pm As StringDim n As Stringpm = InputBox("产品名", "请输入", 0)n = "select * from 库存表 where 品名 = '" & pm & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid0End SubPrivate Sub RKCZ_Click()'Form2.HideEnd SubPrivate Sub RKSHJ_Click()Frame2.Caption = "入库信息"Dim RKRQ As StringDim n As StringRKRQ = InputBox("入库日期,格式为:月/日/年如:12/1/2011", "请输入", 0) n = "select * from 入库表 where 入库日期 = '" & RKRQ & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid1End SubPrivate Sub RKXHCHX_Click()Frame2.Caption = "入库信息"Dim XH As StringDim n As StringXH = InputBox("产品型号", "请输入", 0)If Len(XH) > 0 Thenn = "select * from 入库表 where 型号 = '" & XH & "'" mandType = adCmdTextAdodc2.RecordSource = nElseLabel6.Move Label6.Left - 80ElseLabel6.Left = Form2.ScaleWidthEnd IfIf Label7.Left + Label7.Width > 0 ThenLabel7.Move Label7.Left - 80ElseLabel7.Left = Form2.ScaleWidthEnd IfEnd SubPrivate Sub XGMM_Click()'Form2.HideForm4.ShowEnd SubPrivate Sub XHCX_Click()Frame2.Caption = "库存信息"Dim XH As StringDim n As StringXH = InputBox("产品型号", "请输入", 0)If Len(XH) > 0 Then 'And Val(XH) <> 0n = "select * from 库存表 where 型号 = '" & XH & "'"End WithEnd SubPrivate Sub InitGrid1()With DataGrid1.Columns(0).Width = 800.Columns(1).Width = 1600.Columns(2).Width = 1600.Columns(3).Width = 800.Columns(4).Width = 800.Columns(5).Width = 1000.Columns(6).Width = 800.Columns(7).Width = 4000End WithEnd SubPrivate Sub InitGrid2()With DataGrid1'.Columns(0).Caption = "学号"' .Columns(1).Caption = "课程名"'.Columns(2).Caption = "学分"' .Columns(3).Caption = "成绩"'设置DtgCond的列宽Text1.Text = ""Text2.Text = ""Text1.SetFocusExit SubEnd IfUnload MeForm2.Show'MsgBox "登陆成功!", , "登录提示信息:"ElseMsgBox "密码不正确,请重新输入!", , "登录提示信息:"Text2.Text = ""Text2.SetFocusEnd IfEnd SubPrivate Sub Command2_Click()Unload MeForm2.ShowEnd Sub修改用户密码界面代码:ElseEnd IfIf Text3.Text = "" ThenMsgBox "请输入新密码!", , "信息提示!"Text3.SetFocusExit SubEnd IfIf Text4.Text = "" ThenMsgBox "请再次输入新密码!", , "信息提示!" Text4.SetFocusExit SubEnd IfIf Trim(Text3.Text) <> Trim(Text4.Text) ThenMsgBox "两次输入的新密码不一致!", , "信息提示!" Text3.Text = ""Text4.Text = ""Text3.SetFocusExit SubElseMsgBox ("密码修改成功!")Unload Me'Form2.ShowEnd SubEnd Sub代码:ElseText5.SetFocusExit SubEnd IfAdodc1.RefreshEnd IfDim pm As StringDim pms As StringDim n As StringDim m As Stringpm = Trim(Text1.Text)n = Val(Text3.Text)pms = "select * from 库存表 where 品名='" & pm & "'"With Form2End WithElseEnd IfEnd IfDim X As IntegerX = MsgBox("产品入库登记成功,是否继续添加产品!", vbYesNo + vbQuestion + vbDefaultButton1, "提示信息!") If X = vbNo ThenUnload MeElseEnd SubEnd SubUnload Me'Form2.ShowEnd Sub出库管理代码:Private Sub Command1_Click()If Combo1.Text = "" And Combo2.Text = "" Then ' text1.Text = "" And Text2.Text = "" ThenMsgBox "“品名”和“型号”不能同时为空,必须输入其中一项!", , "提示信息!" Exit SubElseIf Text1.Text = "" And Combo3.Text = "" Then ' Text4.Text = "" ThenMsgBox "请输入产品“数量”或“单位”之一!", , "提示信息!"Text2.SetFocusExit SubEnd IfIf Text2.Text = "" ThenMsgBox "请经手人签名!", vbCritical, "提示信息!"Text2.SetFocusDim ZB As StringZB = "select * from 出库表 " 'where 品名 = '" & PM & "'"End SubPrivate Sub Command2_Click()Combo1.Text = ""Combo2.Text = ""Combo3.Text = ""Text1.Text = ""Text2.Text = ""Text3.Text = ""End SubPrivate Sub Command3_Click()Unload Me'Form2.ShowEnd SubPrivate Sub Form_Load()Adodc2.RefreshLoopEnd Sub代码:Elsepm = Trim(Combo1.Text)n = Val(Text1.Text)pms = "select * from 库存表 where 品名='" & pm & "'"End IfDim X As IntegerX = MsgBox("产品借出登记成功,是否继续添加产品!", vbYesNo + vbQuestion + vbDefaultButton1, "提示信息!") If X = vbNo ThenUnload MeForm2.ShowEnd IfCombo2.Text = ""Combo3.Text = ""Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Dim ZB As StringZB = "select * from 借出表 " 'where 品名 = '" & PM & "'"End SubPrivate Sub Command2_Click()End SubEnd SubLoopEnd Sub代码:ElseIf Text1.Text = "" And Combo3.Text = "" Then ' Text4.Text = "" Then MsgBox "请输入产品“数量”或“单位”之一!", , "提示信息!"Text1.SetFocusExit SubEnd IfIf Text2.Text = "" ThenMsgBox "请经手人签名!", vbCritical, "提示信息!"Text2.SetFocusExit SubEnd IfIf Text3.Text = "" ThenMsgBox "请输入归还人姓名!", vbCritical, "提示信息!" Text3.SetFocusExit SubEnd IfAdodc1.RefreshEnd IfDim pm As StringDim pms As StringDim n As StringEnd SubText1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""End SubPrivate Sub Command3_Click()Unload MeForm2.ShowEnd SubPrivate Sub Form_Load()' Dim i As String' i = 0' Adodc2.Refresh' i = i + 1' LoopCall pmEnd SubPrivate Sub pm()Dim i As VariantDim j As VariantDim k As Varianti = 0j = 0LoopText5.Text = s 'a + "," + D(2) + D(1) '+ " " + Val(i) + " " + Val(j) + " " + Val(k) Text6.Text = j'Combo1.AddItem D(1)End Sub。
摘要随着科学技术的发展,计算机应用领域也越来越广泛。
计算机在代替和延伸脑力劳动方面发挥着越来越重要的作用,不仅在工业方面,而且在日常工作和生活中也越来越离不开计算机,尤其是在大、中型企业中,要对大量的有关生产设备和办公设备进行管理。
在信息化和数字化的今天,为了加快对企业的资产管理,必须依靠计算机,使企业对资产的管理更加简单,更加完善。
基于上述种种原因,开发一套企业资产管理系统是必然的趋势。
本系统是在信息管理系统的理论和方法指导下,采用面向对象、事件驱动的Microsoft Visual Basic 6.0开发语言,结合Access 2007作为后台数据库,生成可执行文件。
本文在结构上首先论述了毕业设计选题的背景、目的和意义,然后叙述了开发平台和数据库技术及其各自的特点,接着用了较多篇幅阐述了系统的需求分析、数据库需求分析、数据库实现以及实施的技术和工具,最终系统能够完成信息的输入、输出,数据的修改、查询和统计以及打印报表等功能,使用户操作起来简便快捷。
关键词:资产管理;数据库;Access 2007; Microsoft Visual Basic 6.0;AbstractContinuously obtain the new research result along with the development of calculator realm of the science technique.Calculator is playing a more and more significant role in replacing and extending mental work.Not only in industrial aspect ,but also in our daily life calculator is indispensible for us.Particularly in the large enterprises and middle enterprises, calculator is used for controling the production equipment and office equipment of the large quantity.On an informational and digital’s age, for the reason of a faster management of enterprises’assets, and make the enterprises management of assets more brief and perfect,we need the calculator to help us. Considering the reason above, developping a enterprises’ assets management system is extremely urgent.This system is under the guide of information management system's theories and methods,take Microsoft Visual Basic with the feature of facing object and event driver as the development of language ,use Access 2007 as database,and create executable file.This paper first discussed the background, purpose and the meaning of the graduate design on the structure.Then described the development platform and the database technique with their features, then it used many spaces to describe the analysis of the system's need, the analysis of the database's need, and the tool to put it into practice.In the end, the final system can complete the information's input, output, the data’s modification, searching with the statistics and the printing of the statement etc. It is more convenient for users to work with it.Key words:Assets managing;Database;Access2007; Microsoft Visual Basic 6.0;目录1 绪论............................................................... - 1 -1.1 课题背景.................................................. - 1 -1.2 目的及意义................................................ - 1 -1.3 开发和运行环境选择........................................ - 1 -1.4 编程环境的选择............................................ - 2 -1.4.1 Visual Basic简介及实现原理............................ - 2 -1.4.2 数据库组件介绍......................................... - 3 -1.4.3 SQL语言在VB中的应用.................................. - 4 -1.5 数据库平台介绍............................................ - 4 -1.5.1 Access 2007 数据库简介................................. - 4 -1.5.2 数据库的基本概念....................................... - 5 -1.5.3 结构化查询语言SQL ..................................... - 6 -1.5.4 SQL语句简介........................................... - 6 -2 系统设计........................................................... - 8 -2.1 系统功能分析.............................................. - 8 -2.2 系统功能模块设计.......................................... - 8 -3 数据库设计........................................................ - 10 -3.1 数据库需求分析........................................... - 10 -3.2 数据库概念结构设计....................................... - 11 -3.3 数据库逻辑结构设计及实现................................. - 13 -4 系统具体程序实现.................................................. - 15 -4.1 系统公共模块和类模块的创建............................... - 15 -4.1.1 创建工程项目——PrjDevice ............................. - 15 -4.1.2 创建公用模块.......................................... - 15 -4.1.3 创建类模块............................................ - 16 -4.2 系统用户登录窗体的创建................................... - 16 -4.3 企业资产管理系统主窗体的创建.............................. - 18 -4.3.1 资产管理模块.......................................... - 22 -4.3.2 资产查询模块.......................................... - 26 -4.3.3 报表管理模块.......................................... - 27 -4.3.4 系统管理模块.......................................... - 30 -4.3.5 用户管理模块.......................................... - 31 -5 系统的编译和发行.................................................. - 33 -6 小结.............................................................. - 34 - 致谢................................................................ - 35 - 主要参考文献......................................................... - 36 - 附录................................................................ - 38 -1绪论1.1课题背景随着信息技术广泛、深入地应用到人类社会的各个领域并发挥着越来越重要的作用。
本科生毕业设计(论文)任务书系(教研室)主任审批数学与计算科学学院信息与计算科学系(教研室)签名:日期:学生姓名:学号:101071069 专业:信息与计算科学1、设计(论文)题目及专题:职工工资管理信息系统2、学生设计(论文)时间:自2005年1 月5 日开始至2005 年5 月20 日止3、设计(论文)所用资料和参考资料:[1] 陈艳华,深入浅出Access 2002数据库实例开发[M],中国青年出版社,2003.53-57.[2] HTML,VBSCRIPT与ASP三合一最新培训教程。
电子工业出版社,曹建主编,杨静等编著。
2004 .142-148.[3] Visual Basic 网络程序设计.人民邮电出版社出版.卡志强编著.2004.39-75.[4] 苗雪兰,刘瑞新,王怀峰、数据库系统原理及应用教程[M],机械工业出版社,2001.175-198.[5] 张海藩.软件工程导论[M].清华大学出版社.1998.18-35.[6] 张丕军,杨顺花,王靖诚,中文版PhotoshopCS完全自学手册[M],海洋出版社,2005.193-245.4、设计(论文)完成的主要内容:本文主要介绍职工工资管理信息系统的开发过程。
论文详尽地论述从需求分析,系统分析,概要设计,详细设计,到测试与调试的整个开发过程,总结开发过程中的经验及本系统今后的改进方向。
5、提交设计(论文)形式(设计说明与图纸或论文等)及要求:提交职工工资信息管理系统的毕业设计论文(打印版)一份及相同内容的电子文档一份6、发题时间:2005年 1 月 5 日指导老师(签名):学生(签名):。
VB连接ACCESS例子及全部代码VB连接ACCESS例子及全部代码2007-03-19 13:40:32| 分类:sql相关|字号订阅1.首先创建一个新工程,取名为OpenSql,即Open Sql的缩写,意思是在Open方法中采用Sql查询。
2.打开“引用”对话框,选取Microsoft ActiveX Data Object 2.1 Library3.打开“部件”对话框,选取Microsoft Windows Common Control 6.0,工具箱中便添加了若干控件,其中一个名为ListView的控件.4.将控件ListView控件加载到窗体中,取名为ListView1.窗体中中有这样一个控件,别无其他,所以是一个特别简单的界面。
5.在代码窗口中的全部代码如下。
Dim WithEvents myConnection As ADODB.ConnectionDim myRecordset As New ADODB.RecordsetPrivate Sub Form_Load()Dim myPath As StringDim srtConec As StringSet myConec = New ADODB.ConnectionmyPath = App.Path & "\TD.mdb;"strconec = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & myPathmyConec.Open strconec'If strconec <= 0 Then' MsgBox "Connection Failed!"'Else' MsgBox "Congratulations,Established!"'End IfDim strSql As StringListView1.Top = 0ListView1.Left = 0myRecordset.CursorType = adOpenKeysetmyRecordset.LockType = adLockReadOnlystrSql = "select * from TBillInfo"myRecordset.Open strSql, myConec, , , adCmdTextShowListViewmyRecordset.ClosemyConec.CloseEnd SubPublic Sub ShowListView()Dim clmHead As ColumnHeaderDim ListItm As ListItemDim i As IntegerListView1.ColumnHeaders.ClearListView1.ListItems.ClearListView1.FullRowSelect = TrueListView1.View = lvwReportFor i = 0 To myRecordset.Fields.Count - 1Set clmHead = ListView1.ColumnHeaders.Add()clmHead.Text = myRecordset.Fields(i).Name NextmyRecordset.MoveFirstDo While Not myRecordset.EOFSet ListItm = ListView1.ListItems.Add()If IsNull(myRecordset.Fields(0).Value) ThenListItm.Text = "NULL"ElseListItm.Text = myRecordset.Fields(0).Value End IfFor i = 1 To myRecordset.Fields.Count - 1If IsNull(myRecordset.Fields(i).Value) ThenListItm.SubItems(i) = "NULL"ElseListItm.SubItems(i) = myRecordset.Fields(i).Value End IfNextmyRecordset.MoveNextLoopListView1.View = lvwReportEnd SubPrivate Sub Form_Resize()ListView1.Width = Width - 200ListView1.Height = Height - 400End SubPrivate Sub Form_Terminate()Set myRecordset = NothingSet myConnection = NothingEnd SubPrivate Sub ListView1_BeforeLabelEdit(Cancel As Integer) End Sub---------------------------。
精心整理精心整理仓库管理系统项目的建立这是本人利用闲暇之余在VB6.0上制作的一个简陋的类库管系统,现图文结合的方式一步一步展现制作过程。
由于本人是个初学者,里面存在很多不足之处望得到高手们的指导。
此文可作供: 1、2、3、4、 在“标题”里输入“系统”,在“名称”里输入“Sys ”(注意此处不能为汉字)点击“下一个”再点击“”“确定”退到MDI 界面点击“系统”——“退出”如下,然后编写代码。
代码如下:Private Sub Exit_Click()精心整理EndEnd Sub数据库的建立VB6.0中可以创建Access数据库。
如下建立一个“用户表”的数据库,用来存放用户信息及一些出入库管理信息。
如下图单击“外接程序”点击“”出现1、单击““”明。
2、本窗体代码如下:Private Sub Command1_Click() '“登录”、“确定”按钮If Command1.Caption = "确定" And Command2.Caption = "取消" Then '如果为“确定”则添加新用户If Text1.Text = "" Then '提示用户输入用户名MsgBox "请输入用户名!", , "登录信息提示:"Exit SubElse 'Dim usename As String '检测用户名是否已经存在Dim strS As String精心整理. . .. . .usename = Trim(Text1.Text)strS = "select * from 用户登录信息表where 用户名='" & usename & "'"mandType = adCmdTextAdodc1.RecordSource = strSAdodc1.RefreshMsgBox "您输入的用户已存在!", , "登录提示信息:"Text1.Text = ""Text2.Text = ""Text3.Text = ""Text1.SetFocusExit SubEnd IfEnd IfIf Text2.Text = "" Then '提示用户密码不能为空MsgBox "密码不能为空!", , "登录提示信息:"Text2.SetFocusExit SubEnd IfIf Text3.Text = "" ThenMsgBox "请再次输入密码!", , "登录提示信息:"Text3.SetFocusExit SubEnd IfIf Text2.Text <> Text3.Text ThenMsgBox "两次输入的密码不一致,请确认!", , "登录提示信息:"Text2.Text = ""Text3.Text = ""Text2.SetFocusExit SubElseMsgBox ("添加新用户成功,现在您可以登陆系统了!")Label3.Visible = FalseText3.Visible = FalseCommand1.Caption = "登录"Command2.Caption = "退出"End IfElse '“登录”按钮,用户登录Dim strSno As StringDim strSelect As StringstrSno = Trim(Text1.Text) '检测用户名是否存在strSelect = "select 密码from 用户登录信息表where 用户名= '" & strSno & "'"mandType = adCmdTextAdodc1.RecordSource = strSelectAdodc1.RefreshMsgBox "用户名不存在,请重新输入!", , "登录提示信息:"Text1.Text = "". 专业专注.精心整理Text2.Text = ""Text1.SetFocusExit SubEnd IfForm1.Hide'Unload MeForm2.Show'MsgBox "登陆成功!", , "登录提示信息:"ElseMsgBox "密码不正确,请重新输入!", , "登录提示信息:"Text2.Text = ""Text1.SetFocusEnd SubPrivate Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Label6.Visible = TrueEnd SubPrivate Sub Command3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Label6.Visible = FalseEnd SubPrivate Sub Form_Load()Label3.Visible = False精心整理. . .. . .Text3.Visible = FalseEnd SubPrivate Sub Timer1_Timer() '时间time1控件的time事件代码,用来'显示向左移动的欢迎字幕If Label4.Left + Label4.Width > 0 Then '当标签右边位置大于0时,标签向左移Label4.Move Label4.Left - 80Else '否则标签从头开始Label4.Left = Form1.ScaleWidthEnd IfIf Label5.Left + Label5.Width > 0 ThenLabel5.Move Label5.Left - 80ElseLabel5.Left = Form1.ScaleWidthEnd IfEnd Sub主界面窗体如下:代码:Private Sub AddNew_Click()Frame1.Visible = TrueFrame2.Visible = FalseEnd SubPrivate Sub CHKPMCHX_Click()Frame2.Caption = "出库信息"Dim pm As StringDim n As Stringpm = InputBox("产品名", "请输入", 0)n = "select * from 出库表where 品名= '" & pm & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid1End SubPrivate Sub CHKXHCHX_Click()Frame2.Caption = "出库信息"Dim XH As StringDim n As StringXH = InputBox("产品型号", "请输入", 0)n = "select * from 出库表where 型号= '" & XH & "'"mandType = adCmdTextAdodc2.RecordSource = n. 专业专注.精心整理Adodc2.RefreshEnd SubPrivate Sub CKCZ_Click()'Form2.HideForm6.ShowEnd SubPrivate Sub CKJSHR_Click()Frame2.Caption = "出库信息"Dim JSHR As StringDim n As StringJSHR = InputBox("经手人", "请输入", 0)End SubPrivate Sub Command1_Click()If Text1.Text = "" Then '提示用户输入用户名MsgBox "请输入用户名!", , "登录信息提示:"Exit SubElse 'Dim usename As String '检测用户名是否已经存在Dim strS As Stringusename = Trim(Text1.Text)strS = "select * from 用户登录信息表where 用户名='" & usename & "'"精心整理. . .. . .mandType = adCmdTextAdodc1.RecordSource = strSAdodc1.RefreshMsgBox "您输入的用户已存在!", , "登录提示信息:"Text1.Text = ""Text2.Text = ""Text3.Text = ""Text1.SetFocusExit SubEnd IfEnd IfIf Text2.Text = "" Then '提示用户密码不能为空MsgBox "密码不能为空!", , "登录提示信息:"Text2.SetFocusExit SubEnd IfIf Text3.Text = "" ThenMsgBox "请再次输入密码!", , "登录提示信息:"Text3.SetFocusExit SubEnd IfIf Text2.Text <> Text3.Text ThenMsgBox "两次输入的密码不一致,请确认!", , "登录提示信息:"Text2.Text = ""Text3.Text = ""Text2.SetFocusExit SubElseeDim X As IntegerX = MsgBox("成功添加新用户,是否要重新登录!", vbYesNo + vbQuestion + vbDefaultButton1, "提示信息!") If X = vbYes ThenUnload MeForm3.ShowEnd If'MsgBox ("成功添加新用户!")'Label3.Visible = False'Text3.Visible = False'Command1.Caption = "登录"'Command2.Caption = "退出"End IfFrame1.Visible = FalseFrame2.Visible = TrueText1.Text = ""Text2.Text = "'"Text3.Text = "". 专业专注.精心整理精心整理'Form3.ShowEnd SubPrivate Sub Command2_Click()Frame1.Visible = FalseFrame2.Visible = TrueEnd SubPrivate Sub CXDL_Click()Form3.Show'Unload MeEnd SubPrivate Sub Exit_Click()EndDim pm As StringDim n As Stringpm = InputBox("产品名", "请输入", 0)n = "select * from 归还表 where 品名 = '" & pm & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub GHRCX_Click(). . .. . . Frame2.Caption = "归还信息"Dim JCR As StringDim n As StringJCR = InputBox("归还人", "请输入", 0)n = "select * from 归还表where 归还人= '" & JCR & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub GHSJCX_Click()Frame2.Caption = "归还信息"Dim JCRQ As StringDim n As StringJCRQ = InputBox("归还日期,格式为:月/日/年如:12/1/2011", "请输入", 0)n = "select * from 归还表where 归还日期= '" & JCRQ & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub GHXHCX_Click()Frame2.Caption = "归还信息"Dim XH As StringDim n As StringXH = InputBox("产品型号", "请输入", 0)n = "select * from 归还表where 型号= '" & XH & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub GHZCX_Click()Frame2.Caption = "归还信息"Dim ZB As StringZB = "select * from 归还表"mandType = adCmdTextAdodc2.RecordSource = ZBAdodc2.RefreshCall InitGrid2End SubPrivate Sub JCCZ_Click()'Form2.HideForm7.ShowEnd SubPrivate Sub JCHPMCHX_Click(). 专业专注.精心整理Frame2.Caption = "借出信息"Dim pm As StringDim n As Stringpm = InputBox("产品名", "请输入", 0)n = "select * from 借出表where 品名= '" & pm & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub JCHXHCHX_Click()JCRQ = InputBox("借出日期,格式为:月/日/年如:12/1/2011", "请输入", 0) n = "select * from 借出表where 借出日期= '" & JCRQ & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub JCZCX_Click()Frame2.Caption = "借出信息"Dim ZB As String精心整理ZB = "select * from 借出表"mandType = adCmdTextAdodc2.RecordSource = ZBAdodc2.RefreshCall InitGrid2End SubPrivate Sub JSHRCHX_Click()Frame2.Caption = "归还信息"Dim JSHR As StringDim n As StringJSHR = InputBox("经手人", "请输入", 0)n = "select * from 归还表where 经手人= '" & JSHR & "'" mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub JSHRCX_Click()Frame2.Caption = "借出信息"Dim JSHR As StringDim n As StringJSHR = InputBox("经手人", "请输入", 0)n = "select * from 借出表where 经手人= '" & JSHR & "'" mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid2End SubPrivate Sub PMCX_Click()Frame2.Caption = "库存信息"Dim pm As StringDim n As Stringpm = InputBox("产品名", "请输入", 0)n = "select * from 库存表where 品名= '" & pm & "'" mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid0End SubPrivate Sub RKCZ_Click()'Form2.HideForm5.ShowEnd SubPrivate Sub RKJSHR_Click()Frame2.Caption = "入库信息"Dim JSHR As StringDim n As StringJSHR = InputBox("经手人", "请输入", 0)n = "select * from 入库表where 经手人= '" & JSHR & "'" mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshCall InitGrid1End SubPrivate Sub RKPMCHX_Click()Frame2.Caption = "入库信息"Dim pm As StringXH = InputBox("产品型号", "请输入", 0)If Len(XH) > 0 Thenn = "select * from 入库表where 型号= '" & XH & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshEnd IfCall InitGrid1End SubPrivate Sub RKZCX_Click()Frame2.Caption = "入库信息"Dim ZB As StringZB = "select * from 入库表"mandType = adCmdTextAdodc2.RecordSource = ZBAdodc2.RefreshCall InitGrid1End SubPrivate Sub Timer1_Timer()If Label4.Left + Label4.Width > 0 Then '当标签右边位置大于0时,标签向左移Label4.Move Label4.Left - 80Else '否则标签从头开始Label4.Left = Form2.ScaleWidthEnd IfIf Label5.Left + Label5.Width > 0 ThenLabel5.Move Label5.Left - 80ElseLabel5.Left = Form2.ScaleWidthEnd IfIf Label6.Left + Label6.Width > 0 ThenLabel6.Move Label6.Left - 80ElseLabel6.Left = Form2.ScaleWidthEnd IfIf Label7.Left + Label7.Width > 0 ThenLabel7.Move Label7.Left - 80ElseLabel7.Left = Form2.ScaleWidthEnd IfEnd SubPrivate Sub XGMM_Click()'Form2.HideForm4.ShowEnd SubPrivate Sub XHCX_Click()Frame2.Caption = "库存信息"Dim XH As StringDim n As StringXH = InputBox("产品型号", "请输入", 0)If Len(XH) > 0 Then 'And Val(XH) <> 0n = "select * from 库存表where 型号= '" & XH & "'"mandType = adCmdTextAdodc2.RecordSource = nAdodc2.RefreshEnd IfCall InitGrid0End SubPrivate Sub ZB_Click()Frame2.Caption = "库存信息"Dim ZB As String'Dim N As String'PM = InputBox("产品名", "请输入", 0)ZB = "select * from 库存表" 'where 品名= '" & PM & "'" mandType = adCmdTextAdodc2.RecordSource = ZBAdodc2.RefreshCall InitGrid0'.Columns(0).Caption = "学号"' .Columns(1).Caption = "课程名"'.Columns(2).Caption = "学分"' .Columns(3).Caption = "成绩"'设置DtgCond的列宽.Columns(0).Width = 800.Columns(1).Width = 1600.Columns(2).Width = 1600.Columns(3).Width = 800.Columns(4).Width = 800.Columns(5).Width = 800.Columns(6).Width = 1000.Columns(7).Width = 800.Columns(8).Width = 4000End WithEnd Sub用户重新登录界面代码:Private Sub Command1_Click()Dim strSno As StringDim strSelect As StringstrSno = Trim(Text1.Text) '检测用户名是否存在strSelect = "select 密码from 用户登录信息表where 用户名= '" & strSno & "'"mandType = adCmdTextAdodc1.RecordSource = strSelectAdodc1.RefreshMsgBox "用户名不存在,请重新输入!", , "登录提示信息:"Text1.Text = ""Text2.Text = ""Text1.SetFocusExit SubEnd IfUnload MeForm2.Show'MsgBox "登陆成功!", , "登录提示信息:"ElseMsgBox "密码不正确,请重新输入!", , "登录提示信息:"Text2.Text = ""Text2.SetFocusEnd IfEnd SubPrivate Sub Command2_Click()Unload MeForm2.ShowEnd Sub修改用户密码界面代码:Private Sub Command1_Click()If Trim(Text1.Text) <> Form2.TextUserName ThenMsgBox "用户名不正确,请确认!", , "信息提示!"Text1.Text = ""Text1.SetFocusExit SubElseDim name As StringDim names As Stringname = Trim(Text1.Text)names = "select * from 用户登录信息表where 用户名='" & name & "'"mandType = adCmdTextAdodc1.RecordSource = namesAdodc1.RefreshExit SubElseMsgBox ("密码修改成功!")Unload Me'Form2.ShowEnd IfEnd IfEnd SubPrivate Sub Command2_Click()Unload Me'Form2.ShowEnd Sub入库管理代码:Private Sub Command1_Click()If Text1.Text = "" And Text2.Text = "" ThenMsgBox "“品名”和“型号”不能同时为空,必须输入其中一项!", , "提示信息!"Exit SubText1.SetFocusElseIf Text3.Text = "" And Text4.Text = "" ThenMsgBox "请输入产品“数量”或“单位”之一!", , "提示信息!"Text3.SetFocusExit SubEnd IfIf Text5.Text = "" ThenMsgBox "请经手人签名!", vbCritical, "提示信息!"Text5.SetFocusExit SubEnd IfAdodc1.RefreshEnd IfDim pm As StringDim pms As StringDim n As StringDim m As Stringpm = Trim(Text1.Text)n = Val(Text3.Text)pms = "select * from 库存表where 品名='" & pm & "'"With Form2End WithElseEnd IfEnd IfDim X As IntegerX = MsgBox("产品入库登记成功,是否继续添加产品!", vbYesNo + vbQuestion + vbDefaultButton1, "提示信息!") If X = vbNo ThenUnload Me'Form2.ShowElseText1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Text6.Text = ""Text7.Text = ""Text1.SetFocusEnd IfDim ZB As StringZB = "select * from 入库表" 'where 品名= '" & PM & "'" End SubPrivate Sub Command2_Click()Text1.Text = ""End SubEnd Sub代码:ElseExit SubEnd IfIf Text2.Text = "" ThenMsgBox "请经手人签名!", vbCritical, "提示信息!"Text2.SetFocusExit SubEnd IfAdodc1.RefreshEnd IfDim pm As StringDim pms As StringDim n As StringDim m As Stringpm = Trim(Combo1.Text)n = Val(Text1.Text)pms = "select * from 库存表where 品名='" & pm & "'"End IfDim X As IntegerX = MsgBox("产品出库登记成功,是否继续添加产品!", vbYesNo + vbQuestion + vbDefaultButton1, "提示信息!") If X = vbNo ThenUnload Me'Form2.ShowEnd IfCombo1.Text = ""Combo2.Text = ""Combo3.Text = ""Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Dim ZB As StringZB = "select * from 出库表" 'where 品名= '" & PM & "'"End SubPrivate Sub Command2_Click()Combo1.Text = ""Combo2.Text = ""Combo3.Text = ""Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""End SubPrivate Sub Command3_Click()Unload Me'Form2.ShowEnd SubPrivate Sub Form_Load()Adodc2.RefreshLoopEnd Sub借出管理代码:Private Sub Command1_Click()If Combo1.Text = "" And Combo2.Text = "" Then ' text1.Text = "" And Text2.Text = "" Then MsgBox "“品名”和“型号”不能同时为空,必须输入其中一项!", , "提示信息!"Exit SubElseIf Text1.Text = "" And Combo3.Text = "" Then ' Text4.Text = "" ThenMsgBox "请输入产品“数量”或“单位”之一!", , "提示信息!"Text1.SetFocusExit SubEnd IfIf Text2.Text = "" ThenMsgBox "请经手人签名!", vbCritical, "提示信息!"End IfEnd IfEnd IfText4.Text = ""Dim ZB As StringZB = "select * from 借出表" 'where 品名= '" & PM & "'"End SubPrivate Sub Command2_Click()Combo1.Text = ""Combo2.Text = ""Combo3.Text = ""Text1.Text = ""Text2.Text = "". . .. . . Text3.Text = ""Text4.Text = ""End SubPrivate Sub Command3_Click()Unload MeForm2.ShowEnd SubPrivate Sub Form_Load()Adodc2.RefreshLoopEnd Sub归还管理代码:Private Sub Command1_Click()If Combo1.Text = "" And Combo2.Text = "" Then ' text1.Text = "" And Text2.Text = "" Then MsgBox "“品名”和“型号”不能同时为空,必须输入其中一项!", , "提示信息!"Exit SubElseIf Text1.Text = "" And Combo3.Text = "" Then ' Text4.Text = "" ThenMsgBox "请输入产品“数量”或“单位”之一!", , "提示信息!"Text1.SetFocusExit SubEnd IfIf Text2.Text = "" ThenMsgBox "请经手人签名!", vbCritical, "提示信息!"Text2.SetFocusExit SubEnd IfIf Text3.Text = "" ThenMsgBox "请输入归还人姓名!", vbCritical, "提示信息!"Text3.SetFocusExit SubEnd IfAdodc1.RefreshEnd IfDim pm As StringDim pms As StringDim n As StringDim m As Stringpm = Trim(Combo1.Text)n = Val(Text1.Text)pms = "select * from 库存表where 品名='" & pm & "'"End If. 专业专注.精心整理精心整理Dim X As IntegerX = MsgBox("产品归还登记成功,是否继续添加产品!", vbYesNo + vbQuestion + vbDefaultButton1, "提示信息!") If X = vbNo ThenUnload MeForm2.ShowEnd IfCombo1.Text = ""Combo2.Text = ""Combo3.Text = ""Text1.Text = ""Text2.Text = ""End SubEnd SubEnd Sub' i = 0' ' LoopEnd SubPrivate Sub pm()Dim i As VariantDim j As VariantDim k As VariantDim a As VariantDim b As VariantDim c As VariantDim s As VariantDim D As Variant. . .. . .i = 0j = 0Adodc2.Refreshi = i + 1LoopD = Split(a, ",")If j < i Thens = D(2)Combo1.AddItem s'k = 0'If k < j And D(k) <> D(j) Then'If D(k) <> D(j) Then' Combo1.AddItem D(j)' k = k + 1' Else' k = k + 1'End If'End Ifj = j + 1End IfText5.Text = s 'a + "," + D(2) + D(1) '+ " " + Val(i) + " " + Val(j) + " " + Val(k)Text6.Text = j'Combo1.AddItem D(1)End Sub. 专业专注.。
在VB中访问ACCESS数据库的方法visual basic具有面向对象、软件的集成式开发、事件驱动、结构化的程序设计语言、数据库访问功能、网络功能、支持对象的链接与嵌入技术、支持动态交换、多个应用程序向导等特点。
以可视化的窗口为主的应用广泛的编程软件。
一、visual basic课程开设的意义对于中职的计算机专业的学生到第五学期面临综合实践的完成。
我们利用了vb的面向对象的程序设计思想,是将复杂的程序设计问题分解为多外具有独立功能并相对简单的对象集合等特点开设了这门课程以帮忙学生完成毕业设计。
二、开发实例中的难点及问题软件开发中程序员可根据程序和界面设计要求,直接在先设计出窗口、菜单、按钮等不同类型的对象,并为每个对象设置好具体的属性。
事件的触发是由用户通过方法来完成的操作,也可以由系统或应用程序触发。
所以学生在每章每节的课堂点点滴滴的教学中掌握并理解了具体的控件。
三、行之有效的连接方法开发数据库管理系统就是要对数据库进行操作时,一是要使用户可以在窗口界面上对需要的数据进行访问;二是对数据库中的数据进行各种操作,最后的结果还要反馈给用户。
这里我们采用adodb,相比dao和能访问数据库的api来说,它比dao更灵活,更强大;而比起api,它更简单易用,更适合初学者。
而access数据库比起sql也相对简单了很多,且能够满足中小型应用程序的需要,所以我们在使用数据库时,选择了access。
下面我就自己的一点教学经验谈谈在vb中连接access数据库的两种有效的方法:第一种方法:首先我们从控件箱中托入一个adodc1控件到窗口中,adodc1控件名称为date1,然后在 date1控件的属性里设置数据库文件的路径。
设置date1控件的属用以连接数据库,在date控件上右键——adodc属性——使用连接字符串——成——microsoft jet 4.0 ole db provider——下一步——选择或输入数据库名称——找到要连接的数据库后,确定。
计算机毕业论文论文题目图书管理系统院(系)名称计算机学院专业名称计算机科学与技术班级学生姓名学号指导教师姓名毕业设计(论文)原创性声明和使用授权说明原创性声明本人郑重承诺:所呈交的毕业设计(论文),是我个人在指导教师的指导下进行的研究工作及取得的成果。
尽我所知,除文中特别加以标注和致谢的地方外,不包含其他人或组织已经发表或公布过的研究成果,也不包含我为获得及其它教育机构的学位或学历而使用过的材料。
对本研究提供过帮助和做出过贡献的个人或集体,均已在文中作了明确的说明并表示了谢意。
作者签名:日期:指导教师签名:日期:使用授权说明本人完全了解大学关于收集、保存、使用毕业设计(论文)的规定,即:按照学校要求提交毕业设计(论文)的印刷本和电子版本;学校有权保存毕业设计(论文)的印刷本和电子版,并提供目录检索与阅览服务;学校可以采用影印、缩印、数字化或其它复制手段保存论文;在不以赢利为目的前提下,学校可以公布论文的部分或全部内容。
作者签名:日期:学位论文原创性声明本人郑重声明:所呈交的论文是本人在导师的指导下独立进行研究所取得的研究成果。
除了文中特别加以标注引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写的成果作品。
对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。
本人完全意识到本声明的法律后果由本人承担。
作者签名:日期:年月日学位论文版权使用授权书本学位论文作者完全了解学校有关保留、使用学位论文的规定,同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。
本人授权大学可以将本学位论文的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存和汇编本学位论文。
涉密论文按学校规定处理。
作者签名:日期:年月日导师签名:日期:年月日第一章 Visual Basic 企业版简介Visual Basic(VB)是一种由微软公司开发的包含协助开发环境的事件驱动编程语言。
vb工资管理系统(ACCESS版).txt年轻的时候拍下许多照片,摆在客厅给别人看;等到老了,才明白照片事拍给自己看的。
当大部分的人都在关注你飞得高不高时,只有少部分人关心你飞得累不累,这就是友情!Public Class Form1Inherits System.Windows.Forms.Form#Region " Windows 窗体设计器生成的代码 "........(省略了系统自动生成的代码)#End RegionPrivate Sub BtEnabled(ByVal bool As Boolean)'把一个布尔型的参数作为按钮的属性BtView.Enabled = boolBtDelete.Enabled = boolBtUpdate.Enabled = boolBtPrev.Enabled = boolBtLast.Enabled = boolBtNext.Enabled = boolBtTop.Enabled = boolBtFind.Enabled = boolEnd SubPrivate Sub BtView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtView.ClickTry'设定查询语句mandText = "select * from 工资表" Ds1.Clear() '清空数据集OleDbDataAdapter1.Fill(Ds1) '填充数据Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行Me.TxtLocationChange() '指示当前活动行的位置Catch ex As ExceptionMsgBox(ex.Message)End TryEnd SubPrivate Sub BtAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtAdd.ClickTryIf BtAdd.Text = "添加" Then '判断是否第一次按下按钮Me.BindingContext(Ds1, "工资表").AddNew() '增加一行新行BtAdd.Text = "确定"Me.BtEnabled(False) '将其他按钮设为不可用,防止用户误操作ElseIf BtAdd.Text <> "确定" Then '用户第二次按下按钮Exit SubEnd IfMe.BindingContext(Ds1, "工资表").EndCurrentEdit() '把数据返回数据集OleDbDataAdapter1.Update(Ds1.工资表) '更新数据集,调用添加语句MsgBox("添加成功!")BtAdd.Text = "添加"Me.BtEnabled(True) '把按钮设为可用Me.TxtLocationChange() '指示当前活动行的位置Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择活动行End IfCatch ex As ExceptionIf Err.Number = 5 ThenMsgBox("已有相同记录存在!")ElseMsgBox(ex.Message)End IfEnd TryEnd SubPrivate Sub BtDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtDelete.ClickTry'确定是否要删除数据If MsgBox("真的要删除此记录?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then'删除数据集中当前的活动行Ds1.工资表.Rows(Me.BindingContext(Ds1, "工资表").Position).Delete()OleDbDataAdapter1.Update(Ds1) '更新数据集,调用删除语句Me.TxtLocationChange() '指示当前活动行的位置Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行 End IfCatch ex As ExceptionMsgBox(ex.Message)End TryEnd SubPrivate Sub BtUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtUpdate.ClickTryMe.BindingContext(Ds1, "工资表").EndCurrentEdit() '把数据返回数据集If Ds1.HasChanges(DataRowState.Modified) Then '判断是否有更改OleDbDataAdapter1.Update(Ds1) '更新数据集,调用更改语句MsgBox("更改成功!")End IfCatchEnd TryEnd SubPrivate Sub BtCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtCancel.ClickMe.BindingContext(Ds1, "工资表").CancelCurrentEdit() '取消添加新行BtAdd.Text = "添加"Me.BtEnabled(True) '将部分按钮设为可用End SubPrivate Sub BtExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtExit.ClickApplication.Exit()End SubPrivate Sub BtFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtFind.ClickTryIf Trim(TxtFind.Text) = "" Then '判断查找内容是否为空,如是为空退出 Exit SubEnd If '设定查询语句mandText = "select * from 工资表where 工号 like '" & TxtFind.Text & "%'"Ds1.Clear()OleDbDataAdapter1.Fill(Ds1) '填充数据Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行Me.TxtLocationChange() '指示当前活动行的位置CatchEnd TryEnd SubPrivate Sub BtNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtNext.ClickIf Me.BindingContext(Ds1, "工资表").Count = 0 Then '判断是否有对象,没有则退出Exit SubEnd IfDim i As Integer '获取数据行的总数i = Me.BindingContext(Ds1, "工资表").Count - 1 '列的数据总长度If Me.BindingContext(Ds1, "工资表").Position < i Then '判断是否已经是最后一行Me.BindingContext(Ds1, "工资表").Position += 1 '指向当前位置的下一行Me.TxtLocationChange() '指示当前活动行的位置End IfDataGrid1.UnSelect(DataGrid1.CurrentRowIndex - 1) '取消原来活动行的选择 Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行End SubPrivate Sub BtLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtLast.ClickIf Me.BindingContext(Ds1, "工资表").Count = 0 Then '判断是否有对象,没有则退出Exit SubEnd IfMe.DataGrid1.UnSelect(DataGrid1.CurrentRowIndex) '取消原来活动行的选择 '指定活动行为最后一行Me.BindingContext(Ds1, "工资表").Position = Me.BindingContext(Ds1, "工资表").Count - 1Me.TxtLocationChange() '指示当前活动行的位置Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行End SubPrivate Sub BtPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtPrev.ClickIf Me.BindingContext(Ds1, "工资表").Count = 0 Then '判断是否有对象,没有则退出Exit SubEnd IfIf Me.BindingContext(Ds1, "工资表").Position > 0 Then '判断是否在第一行 '指向上一行Me.BindingContext(Ds1, "工资表").Position = (Me.BindingContext(Ds1, "工资表").Position - 1)Me.TxtLocationChange() '指示当前活动行的位置End IfDataGrid1.UnSelect(DataGrid1.CurrentRowIndex + 1) '取消原来活动行的选择 Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行End SubPrivate Sub BtTop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtTop.ClickIf Me.BindingContext(Ds1, "工资表").Count = 0 Then '判断是否有对象,没有则退出Exit SubEnd IfMe.DataGrid1.UnSelect(DataGrid1.CurrentRowIndex) '取消原来活动行的选择 Me.BindingContext(Ds1, "工资表").Position = 0 '指定活动行为第一行Me.TxtLocationChange() '指示当前活动行的位置Me.DataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行End SubPrivate Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseUpTryDataGrid1.Select(DataGrid1.CurrentRowIndex) '选择当前活动行Me.TxtLocationChange() '指示当前活动行的位置CatchIf Err.Number = 9 ThenMsgBox("表中没有数据")End IfEnd TryEnd SubPrivate Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged'总额=基本工资+加班费+奖金+津贴TextBox8.Text = Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) + Val(TextBox7.Text)End SubPrivate Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChangedTextBox8.Text = Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) + Val(TextBox7.Text)End SubPrivate Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChangedTextBox8.Text = Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) + Val(TextBox7.Text)End SubPrivate Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChangedTextBox8.Text = Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) + Val(TextBox7.Text)End SubPrivate Sub TxtLocationChange()'中间指示位置变化的文本内容的变化Me.TxtLocation.Text = (((Me.BindingContext(Ds1, "工资表").Position + 1).ToString + " 的 ") + Me.BindingContext(Ds1, "工资表").Count.ToString)End SubEnd Class。