欢迎来到天天文库
浏览记录
ID:15594641
大小:104.00 KB
页数:18页
时间:2018-08-04
《项目实训代码_(1)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、FORM1Me.frmPrivateSubForm1_Load()OptionExplicitPublicLoginSucceededAsBoolean'引用MicrosoftActiveXDataObjects2.6Library'定义连接对象和记录集DimconnAsADODB.ConnectionDimrsAsADODB.Recordset'对取消按钮单击事件的响应PrivateSubcmdCancel_Click()'设置全局变量为false'不提示失败的登录LoginSucceeded=FalseMe.H
2、ideEndSub'对登录按钮单击事件的响应PrivateSubcmdOK_Click()Setconn=NewADODB.ConnectionSetrs=NewADODB.Recordset'建立无源数据库连接conn.ConnectionString="driver={sqlserver};server=Dell--181;uid=sa;pwd=;Database=人事系统管理"conn.ConnectionTimeout=50conn.OpenDimstrAsString'连接连接对象Setrs.Active
3、Connection=conn'设置游标类型rs.CursorType=adOpenDynamicIfTrim(txtUserName.Text="")ThenMsgBox"用户名不能为空,请重新输入用户名!",vbOKOnly+vbExclamation,"警告"txtUserName.SetFocusElse'设置查询字符串str="select*fromlogin_userwherename='"&Trim(txtUserName.Text)&"'"rs.OpenstrIfrs.EOF=TrueThenMsg
4、Box"没有这个用户,请重新输入用户名!",vbOKOnly+vbExclamation,"警告"txtUserName.SetFocusElse'登录成功,连接主窗口If(Trim(txtPassword.Text)=Trim(rs.Fields("password")))ThenLoginSucceeded=TrueMe.HideForm2.ShowElseMsgBox"密码不正确,请重输入密码!",,"警告"txtPassword.SetFocusSendKeys"{Home}+{End}"EndIfEndI
5、fEndIfEndSubPrivateSubLabel5_Click()Form8.ShowMe.HideEndSubForm2人事管理系统菜单PrivateSubCommand1_Click()Form2.HideForm4.ShowEndSubPrivateSubCommand2_Click()Form2.HideForm5.ShowEndSubPrivateSubCommand3_Click()Form2.HideForm6.ShowEndSubPrivateSubCommand4_Click()Dimstr
6、ResultAsStringstrResult=MsgBox("请在原处修改员工信息,修改后请刷新!",vbOKOnly+vbExclamation,"编辑员工信息")ExitSubEndSubPrivateSubCommand5_Click()DimstrResultAsStringstrResult=MsgBox("是否真的要删除该员工信息?",vbYesNoCancel+vbQuestion+vbDefaultButton1,"退出询问")IfstrResult=vbYesThenAdodc1.Records
7、et.DeleteAdodc1.Recordset.MovePreviousElseIfstrResult=vbNoThenEndIfEndIfEndSubPrivateSubCommand6_Click()Dimname$Adodc1.Recordset.MoveFirstname=Trim(InputBox("请输入姓名"))Adodc1.Recordset.Find"姓名="&"'"&name&"'"IfNotAdodc1.Recordset.EOFThenMsgBoxAdodc1.Recordset.Fie
8、lds("姓名")&""&Adodc1.Recordset.Fields("职工编号")&""&Adodc1.Recordset.Fields("电话")ElseMsgBox"没有该职工记录"EndIfEndSubPrivateSubCommand7_Click()EndEndSubPrivateSubCommand8_Click()Adodc1.Recor
此文档下载收益归作者所有