十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
vb2010.net + SQL2005 简单搞定。
创新互联建站主要从事做网站、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务黄南州,十年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108
就是数据库的最基本操作,增加修改删除!
刚好做过这个论文,给你回答啦~~独家哦,分数要给偶~~
1) 系统意义
随着计算机应用的日益普及,各企事业在人事方面实现规范化、计算机自动化管理势在必行,是提高科学管理水平的重要手段,是提高工作效率的可靠途径。
2) 系统特点
1 将人事信息实现自动化管理;
2 提供各种查询、修改、删除、插入人才信息功能;
3 提供各种信息统计功能。
3) 系统设计环境
1 Windows 2000 Server 或 Windows XP;
2 SQL Server 2000数据库管理系统;
3 VB 6.0。
二 系统需求分析
1) 系统设计目标
1 在人事管理过程中,实现信息自动化管理。
2 实现各种信息的修改、删除、插入功能。
3 实现对各种信息的查询、统计。
4 按年份月份统计某个职工的出勤情况信息。
5 按某年某月某日统计查询某部门的迟到和早退人数。
6 按月统计每个人的加班天数。
7 按年统计调入调出人数信息。
2) 系统需求分析
1. 信息需求分析
通过对人事信息系统的分析,此系统需要包含如下信息(数据字典):
1)人事档案基本信息:
编号、姓名、性别、出生日期、工作年限、电话、地址、E-mail、学历、专业、进入本单位时间(编号要求:长度为6的数字字符组成)
2)人事调动信息:
原部门、新部门、原职务、新职务、调出时间、调入时间
3)人事考勤信息:
上下班时间、迟到次数、早退次数、请假天数、加班天数、加班日期
4)系统用户管理信息:
用户帐号、密码(由6个数字组成)、记录用户最近一次登录信息:年月日
2.功能需求分析
1)人事档案基本信息的录入、更新、删除、查询;
2)人事调动信息的录入、更新、删除、查询;
3)人事考勤信息的录入、更新、删除、查询;
3. 概念结构设计
系统的E-R图如图1.1所示:
1)数据库设计
1 逻辑结构设计
人事基本信息(编号,姓名,出生日期,工作年限,电话,E-mail,学历,进单位时间);
人事调动信息(编号,原部门,新部门,原职务,新职务,调出时间,调入时间);
人事考勤信息(编号,上下班时间,迟到次数,早退次数,请假天数,加班天数,加班日期)。
2 各数据表结构
根据实体间E – R模型的需求分析,本系统需要4个数据表分别来存放人是基本信息,调动信息,考勤信息和系统管理员帐号信息,具体如下:
人事基本信息表
字段名 数据类型 长度 是否为空 说明
bh char 10 Not null 编号
name varchar 8 Not null 姓名
sex varChar 3 Not null 性别
gznx varchar 10 null 工作年限
birth Datetime 10 null 出生日期
email Varchar 20 null E-mail
dh Varchar 20 null 电话
xl Varchar 10 null 学历
jdwsj Datetime 10 null 进单位时间
人事调动表
字段名 数据类型 长度 是否为空 说明
ybm varchar 12 Not null 原部门
xbm varchar 12 Not null 新部门
yzw varChar 12 Not null 原职务
xzw varchar 12 null 新职务
dcsj Datetime 10 null 调出时间
drsj Datetime 10 null 调入时间
人事考勤表
字段名 数据类型 长度 是否为空 说明
sxb varchar 10 Not null 上下班时间
cd varchar 5 Not null 迟到次数
zt varChar 5 Not null 早退次数
qj varchar 5 null 请假天数
jbts Datetime 5 null 加班天数
jbrq Datetime 10 null 加班日期
管理员表
字段名 数据类型 长度 是否为空 说明
name char 20 Not null 用户名
password char 8 Not null 密码
人事基本信息模块代码
Option Explicit
Dim mblchange As Boolean
Public txtSQL As String
Public msgtext As String
Dim mrc As ADODB.Recordset
Private Sub cmdcancle_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim intCount As Integer
Dim txtSQL As String
Dim MsgString As String
Dim sMeg As String
Dim i As Integer
For intCount = 0 To 1
If Trim(Text1(intCount) "") = "" Then
Select Case intCount
Case 0
sMeg = "编号"
Case 1
sMeg = "姓名"
End Select
sMeg = sMeg "不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text1(intCount).SetFocus
Exit Sub
End If
Next intCount
If Trim(Text1(3) "") = "" Then
MsgBox "出生日期不能为空", vbOKOnly + vbExclamation, "警告"
End If
If Trim(Text1(3) "") "" Then
If Not IsDate(Text1(3)) Then
MsgBox "出生日期应为(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
Text1(3).SetFocus
Exit Sub
Else
Text1(3) = Format(Text1(3), "yyyy-mm-dd")
End If
End If
If Trim(Text1(2) "") = "" Then
MsgBox "年龄不能为空", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If gintMode = 1 Then
txtSQL = "select * from dangan where ygid='" Trim(Text1(0)) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF = False Then
MsgBox "有重复记录", vbOKOnly + vbExclamation, "警告"
Text1(0).SetFocus
End If
mrc.Close
txtSQL = "delete * from dangan where ygid='" Trim(Text1(0)) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
txtSQL = "select * from dangan"
Set mrc = ExecuteSQL(txtSQL, msgtext)
mrc.AddNew
For intCount = 0 To 1
mrc.Fields(intCount) = Trim(Text1(intCount))
Next intCount
For intCount = 2 To 5
mrc.Fields(intCount) = Trim(Text1(intCount))
Next intCount
For intCount = 6 To 10
mrc.Fields(intCount) = Trim(Text1(intCount))
Next intCount
mrc.Fields(11) = Trim(Combo1.Text)
mrc.Update
If gintMode = 1 Then
MsgBox "添加记录成功", vbOKOnly, "提示"
For i = 0 To 10
Text1(i).Text = ""
Next i
frmyuangong.Show
frmyuangong.ZOrder 0
frmmanrecord.ShowTitle
frmmanrecord.ShowData
frmmanrecord.ZOrder 1
End If
ElseIf gintMode = 2 Then
txtSQL = "select * from dangan where ygid='" Trim(Text1(0).Text) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
For intCount = 0 To 10
mrc.Fields(intCount) = Trim(Text1(intCount))
Next intCount
mrc.Fields(11) = Trim(Combo1.Text)
mrc.Update
MsgBox "修改成功", vbOKOnly, "提示"
Unload Me
frmmanrecord.ShowTitle
frmmanrecord.ShowData
frmmanrecord.ZOrder 0
End If
gintMode = 0
End Sub
Private Sub Form_Load()
Dim msgtext As String
Dim intCount As Integer
With Combo1
.AddItem "男"
.AddItem "女"
End With
If gintMode = 1 Then
Me.Caption = Me.Caption "添加"
Combo1.ListIndex = 0
ElseIf gintMode = 2 Then
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF = False Then
With mrc
For intCount = 0 To 10
Text1(intCount) = .Fields(intCount)
Next intCount
If Not IsNull(!sex) Then
Combo1 = !sex
End If
mrc.Close
Me.Caption = Me.Caption "修改"
End With
End If
End If
mblchange = False
End Sub
Option Explicit
Public sQSql As String
Public mrc As ADODB.Recordset
Public txtSQL As String
Public msgtext As String
Private Sub Check1_Click(Index As Integer)
If Index = 0 Then
Text1(Index).SetFocus
End If
If Index = 1 Then
Text1(Index).SetFocus
Else
Text1(Index).SetFocus
End If
End Sub
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
If Check1(0).Value = vbChecked Then
sQSql = "ygname='" Trim(Text1(0) "") "'"
End If
If Check1(1).Value = vbChecked Then
If Trim(sQSql " ") = "" Then
sQSql = "ygid='" Trim(Text1(1) "") "'"
Else
sQSql = sQSql "and ygid='" Trim(Text1(1) "") "'"
End If
End If
If Check1(2).Value = vbChecked Then
If Trim(sQSql " ") = "" Then
sQSql = "ygdept='" Trim(Text1(2) "") ""
Else
sQSql = sQSql "and ygdept='" Trim(Text1(2) "") "'"
End If
End If
If Trim(sQSql " ") = "" Then
frmmanrecord.txtSQL = "select * from dangan"
flagEdit = True
frmmanrecord.ShowTitle
frmmanrecord.ShowData
frmmanrecord.Show
Else
frmmanrecord.txtSQL = "select * from dangan where " sQSql
flagEdit = True
frmmanrecord.ShowTitle
frmmanrecord.ShowData
frmmanrecord.Show
End If
Me.Hide
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 2
Text1(i) = ""
Next
End Sub
人事考勤模块代码
Option Explicit
Dim mblchange As Boolean
Dim mrc As ADODB.Recordset
Public txtSQL As String
Private Sub cboItem_Click(Index As Integer)
Dim msgtext As String
txtSQL = "select ygid,ygname from dangan where ygdept='" Trim(DataCombo1) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
mrc.MoveFirst
mrc.Move cboItem(1).ListIndex
txtid = Trim(mrc!ygid)
End Sub
Private Sub cboItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
Private Sub cboMonth_Click()
Dim dateTemp As Date
dateTemp = DateAdd("d", -1, DateAdd("m", 1, DateSerial(CInt(cboYear), CInt(cboMonth), 1)))
txtItem(0) = Day(dateTemp)
End Sub
Private Sub cboYear_Click()
Dim dateTemp As Date
If Trim(cboMonth " ") "" Then
dateTemp = DateAdd("d", -1, DateAdd("m", 1, DateSerial(CInt(cboYear), CInt(cboMonth), 1)))
txtItem(0) = Day(dateTemp)
End If
End Sub
Private Sub cmdExit_Click()
If mblchange And gintMode 3 And cmdSave.Enabled Then
If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
Call cmdSave_Click
End If
End If
Unload Me
End Sub
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim sMeg As String
Dim rectemp As Recordset
Dim sSql As String
Dim msgtext As String
For intCount = 0 To 3
If Trim(txtItem(intCount) " ") = "" Then
Select Case intCount
Case 0
sMeg = "本月天数"
Case 2
sMeg = "应出勤天数"
Case 3
sMeg = "出勤"
End Select
If intCount 1 Then
sMeg = sMeg "不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(intCount).SetFocus
Exit Sub
End If
End If
Next intCount
If gintMode = 1 Then
txtSQL = "select * from checkin where kqid='" Trim(txtid) "' and kqdate= '" Format(cboYear.Text "-" cboMonth.Text "-01", "yyyy-mm-dd") "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF = False Then
MsgBox "已经存在该员工在该月的考勤记录!", vbOKOnly + vbExclamation, "警告"
cboMonth.SetFocus
Exit Sub
End If
mrc.Close
txtSQL = "delete from checkin where kqid='" Trim(txtid) "' and kqdate='" Format(cboYear "-" cboMonth "-01", "yyyy-mm-dd") "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
txtSQL = "select * from checkin"
Set mrc = ExecuteSQL(txtSQL, msgtext)
mrc.AddNew
mrc.Fields(0) = Trim(txtid)
mrc.Fields(1) = Trim(cboItem(1))
mrc.Fields(2) = Format(cboYear "-" cboMonth "-01", "yyyy-mm-dd")
For intCount = 0 To 15
mrc.Fields(intCount + 3) = Trim(txtItem(intCount).Text)
Next intCount
For intCount = 16 To 17
mrc.Fields(intCount + 3) = Trim(txtItem(intCount).Text)
Next intCount
mrc.Update
MsgBox "记录添加成功!", vbOKOnly + vbExclamation, "警告"
For intCount = 0 To 17
txtItem(intCount) = ""
Next intCount
mblchange = False
ElseIf gintMode = 2 Then
txtSQL = "select kqid,kqname,kqdays,kqrday,kqtday,kqwork,kqabsent,kqrest,kqleave,kqlate,kqearly,kqforget,kqover1,kqvoer2,kqfill,kqgo,kqpay,kqdeduct,kqother,kqremark from checkin where kqid='" Trim(txtid) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
mrc.Fields(0) = Trim(txtid)
mrc.Fields(1) = Trim(cboItem(1))
For intCount = 0 To 15
mrc.Fields(intCount + 2) = Trim(txtItem(intCount).Text)
Next intCount
For intCount = 16 To 17
mrc.Fields(intCount + 2) = Trim(txtItem(intCount).Text)
Next intCount
mrc.Update
MsgBox "记录修改成功!", vbOKOnly, "提示"
mrc.Close
Unload Me
frmCheck.ShowTitle
frmCheck.ShowData
frmCheck.ZOrder 0
End If
gintMode = 0
End Sub
Private Sub DataCombo1_Click(Area As Integer)
Dim sSql As String
Dim msgtext As String
txtSQL = "select ygid,ygname from dangan where ygdept='" Trim(DataCombo1) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
cboItem(1).Clear
If Not mrc.EOF Then
With cboItem(1)
Do While Not mrc.EOF
.AddItem Trim(mrc!ygname)
mrc.MoveNext
Loop
.ListIndex = 0
End With
cmdSave.Enabled = True
Else
MsgBox "请先建立员工档案!", vbOKOnly + vbExclamation, "警告"
cmdSave.Enabled = False
Exit Sub
End If
End Sub
Private Sub Form_Load()
Dim intCount As Integer
Dim dateTemp As Date
Dim msgtext As String
Adodc1.Visible = False
cboYear.AddItem Year(Now)
cboYear.AddItem Year(Now) - 1
cboYear.ListIndex = 0
For intCount = 1 To 12
cboMonth.AddItem intCount
Next intCount
cboMonth = Month(Now)
If gintMode = 1 Then
Me.Caption = Me.Caption "添加"
'初始化部门名称
txtSQL = "select DISTINCT ygdept from dangan"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF Then
MsgBox "请先进行员工档案登记!", vbOKOnly + vbExclamation, "警告"
cmdSave.Enabled = False
Exit Sub
End If
'初始化本月天数
dateTemp = DateAdd("d", -1, DateAdd("m", 1, DateSerial(CInt(cboYear), CInt(cboMonth), 1)))
txtItem(0) = Day(dateTemp)
mrc.Close
ElseIf gintMode = 2 Then
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF = False Then
With mrc
cboItem(1).AddItem .Fields(1)
cboItem(1).ListIndex = 0
For intCount = 2 To 19
If Not IsNull(.Fields(intCount)) Then
txtItem(intCount - 2) = .Fields(intCount)
End If
Next intCount
txtid = .Fields(0)
End With
End If
mrc.Close
Me.Caption = Me.Caption "修改"
End If
mblchange = False
End Sub
人事调动模块代码
Option Explicit
Dim mblchange As Boolean
Public txtSQL As String
Public msgtext As String
Dim mrc As ADODB.Recordset
Dim mybookmark As Variant
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdchange_Click()
cmdchange.Enabled = False
Command1.Enabled = False
cmddelete.Enabled = False
gintMode = 2
End Sub
Private Sub cmddelete_Click()
Dim st As String
mybookmark = mrc.Bookmark
st = MsgBox("是否删除当前记录?", vbOKCancel, "提示")
If st = vbOK Then
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
mybookmark = mrc.Bookmark
mrc.MoveLast
mrc.Delete
mybookmark = mrc.Bookmark
Call viewdata
Else
mybookmark = mrc.Bookmark
mrc.MovePrevious
mrc.Delete
mrc.Bookmark = mybookmark
Call viewdata
End If
Else
mrc.Bookmark = mybookmark
Call viewdata
End If
End Sub
Private Sub cmdOK_Click()
Dim intCount As Integer
Dim txtSQL As String
Dim MsgString As String
If Text(0) = "" Then
MsgBox "编号不能为空!", vbOKOnly + vbExclamation, "警告"
Text(0).SetFocus
End If
If Text(1) = "" Then
MsgBox "事件不能为空!", vbOKOnly + vbExclamation, "警告"
Text(1).SetFocus
End If
If gintMode = 1 Then
txtSQL = "select * from renshi1 where id='" Trim(Text(0)) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF = False Then
MsgBox "己存在此编号的记录,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text(0).SetFocus
Exit Sub
End If
mrc.Close
txtSQL = "delete * from renshi1 where id='" Trim(Text(0)) "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
txtSQL = "select * from renshi1"
Set mrc = ExecuteSQL(txtSQL, msgtext)
mrc.AddNew
For intCount = 0 To 2
mrc.Fields(intCount) = Trim(Text(intCount))
Next intCount
mrc.Update
MsgBox "添加记录成功!", vbOKOnly, "提示"
frmrenshi.ZOrder 1
frmrenshi.Show
Command1.Enabled = True
cmdchange.Enabled = True
cmddelete.Enabled = True
first.Enabled = True
previous.Enabled = True
next1.Enabled = True
last.Enabled = True
End If
If gintMode = 2 Then
txtSQL = "select * from renshi1"
Set mrc = ExecuteSQL(txtSQL, msgtext)
For intCount = 0 To 2
mrc.Fields(intCount) = Text(intCount).Text
Next intCount
mrc.Update
MsgBox "记录修改成功!", vbOKOnly, "提示"
cmdchange.Enabled = True
Command1.Enabled = True
cmddelete.Enabled = True
End If
gintMode = 0
End Sub
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To 2
Text(i).Text = ""
Next i
Command1.Enabled = False
cmdchange.Enabled = False
cmddelete.Enabled = False
first.Enabled = False
previous.Enabled = False
next1.Enabled = False
last.Enabled = False
gintMode = 1
End Sub
Private Sub first_Click()
mrc.MoveFirst
Call viewdata
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim msgtext As String
Dim i As Integer
txtSQL = "select * from renshi1 "
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF = True Then
MsgBox "没有任何记录,请添加!", vbOKOnly, "提示"
Else
mrc.MoveFirst
Call viewdata
mybookmark = mrc.Bookmark
mblchange = True
End If
mblchange = True
End Sub
Private Sub next1_Click()
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
End If
Call viewdata
End Sub
Private Sub previous_Click()
mrc.MovePrevious
If mrc.BOF Then
mrc.MoveLast
End If
Call viewdata
End Sub
Public Sub viewdata()
Dim intCount As Integer
For intCount = 0 To 2
Text(intCount) = mrc.Fields(intCount)
Next intCount
End Sub
本机上的数据库名字和原来的不一样,所以系统找不到数据库报错
1、vb.net 完全符合面向对象的编程语言抽象、封装、继承的四大特性,而vb不支持继承。
2、错误处理不同。
vb中只是On Error.....goto和On Errer Resume Next ,这些错误称为非结构化异常处理。而在vb.net中采用的结构化异常处理机制,try...catch....finally控制。
3、两者产生的窗体不同。
vb.net 允许创建不同类型的应用程序,例如,创建ASP.NET和ASP.NET Web 服务应用程序,还允许创建控制台应用程序和作为桌面服务运行的应用程序。但是vb 只能创建Windows窗体。
4、数据库访问的差别。
vb6.0是通过ADO(Active X Data Objext)来实现对数据库访问。而vb.net 是通过ADO.NET来访问数据库。
扩展资料
Visual Basic(简称VB)是Microsoft公司开发的一种通用的基于对象的程序设计语言,为结构化的、模块化的、面向对象的、包含协助开发环境的事件驱动为机制的可视化程序设计语言。是一种可用于微软自家产品开发的语言。
“Visual” 指的是开发图形用户界面 (GUI) 的方法——不需编写大量代码去描述界面元素的外观和位置,而只要把预先建立的对象add到屏幕上的一点即可。
“Basic”指的是 BASIC (Beginners All-Purpose Symbolic Instruction Code) 语言,是一种在计算技术发展历史上应用得最为广泛的语言。
Visual Basic源自于BASIC编程语言。VB拥有图形用户界面(GUI)和快速应用程序开发(RAD)系统,可以轻易的使用DAO、RDO、ADO连接数据库,或者轻松的创建Active X控件,用于高效生成类型安全和面向对象的应用程序 。
参考资料:百度百科-Visual Basic