
2. 添加两个文本输入框text1,text2,分别用来接收用户输入用户名和密码。
3、在Adodc1控件的属性窗口中单击Connectionstring右侧的…按钮,打开ADO的属性页,选择“使用连接字符串”,单击“生成”按钮,打开数据链接属性对话框,在“提供程序”页中选择Microsoft Jet 4.0 OLE DB Provider,单击“下一步”,在“连接”页中,输入数据库名称XXXX.mdb(前提是薯瞎将数据库文件和工程文件保存在同一目录下),单击“测试连接”,如果连接成功,单数余空击“确定”即可。
4、将以下代码添加到登录按钮:
Private Sub Command1_Click()
Adodc1.RecordSource = "select * from 数据表名称 where username='毁迹" &Text1.Text &"'"
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox "没有这个用户,请重新输入正确的用户名", , "错误提示"
Else
If Text2.Text = Adodc1.Recordset.Fields("password") Then
MsgBox "登录成功!", , "错误提示"
Else
MsgBox "你的密码错误,请输入正确的用户密码!", , "错误提示"
End If
End If
End Sub
Dim Late As Integer, Aarly As Integer, Absenteeism As Integer, AskLeave As Integer, Total As IntegerPrivate Sub Command1_Click()
Dim AttendanceCase As String
If Option1.Value Then Late = Late + 1: AttendanceCase = Option1.Caption
If Option2.Value Then Aarly = Aarly + 1: AttendanceCase = Option2.Caption
If Option3.Value Then Absenteeism = Absenteeism + 陆返1: AttendanceCase = Option3.Caption
If Option4.Value Then AskLeave = AskLeave + 1: AttendanceCase = Option4.Caption
List1.AddItem Text1.Text + Space(2) + AttendanceCase
End Sub
Private Sub Command2_Click()
Label2.Caption = ""
Total = Late + Aarly + Absenteeism + AskLeave
Label2.Caption = Label2.Caption + "迟到人数:" + CStr(Late) + vbCrLf + "早退人数:" + CStr(Aarly) + vbCrLf + "旷课人数:" + CStr(Absenteeism) + vbCrLf + "睁脊请假人数:" + CStr(AskLeave) + vbCrLf + "总 人 数:" + CStr(Total)
End Sub
Private Sub Command3_Click()
List1.Clear
早早饥Late = 0
Aarly = 0
Absenteeism = 0
AskLeave = 0
Total = 0
Label2.Caption = ""
End Sub
Private Sub Command4_Click()
End
End Sub
1)硬件:尺亩计算机和考勤机通过串口(或以太网口)链接起来2)用VB 接收考勤机发来的毕宴读卡数据
3)用VB创建ACCESS 数据库
用数据库管理考勤信息手困银
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)