本文介绍了如何在USER / EMPLOYEE超时之前设置一小时? VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 问题/我想要发生 1)如果员工/用户时间需要等待3或5个小时才能结束 2)如果她试图超过3或5小时的时间,她将获得一个他/她已经计时的消息框/标签 这是我的代码 getQuery =SELECT dtr.time_in,dtr.date FROM dtr,employee WHERE employee.employee_id ='& empid.Text& _ 'AND dtr.employee_id ='& empid.Text& 'AND dtr.rfid ='& txtRFID.Text& 'AND dtr.date ='& Date.Now.ToString(yyyy-MM-dd)& ' getCommand = New MySqlCommand(getQuery,MySQLConnection) getReader = getCommand.ExecuteReader 如果getReader.Read = True则 TimeIN = (getReader.Item(time_in)。ToString) getDate =(getReader.Item(date)) End if getReader.Close( ) getQuery =SELECT dtr.time_out,dtr.date FROM dtr,employee WHERE employee.employee_id ='& empid.Text& 'AND dtr.employee_id ='& _ empid.Text& 'AND dtr.rfid ='& txtRFID.Text& 'AND dtr.date ='& Date.Now.ToString(yyyy-MM-dd)& ' getCommand = New MySqlCommand(getQuery,MySQLConnection) getReader = getCommand.ExecuteReader 如果getReader.Read = True则 TimeOUT = (getReader.Item(time_out)。ToString) getDate =(getReader.Item(date)) 结束如果 getReader.Close() 如果TimeIN =那么 disableTimeOutColor() TimeIN = Nothing TimeOUT = Nothing getDate = Nothing ElseIf TimeIN<> 和TimeOUT<> 和getDate = Date.Today然后 TimeOUT = Nothing TimeIN = Nothing getDate = Nothing ElseIf TimeIN<> 然后 disableTimeINColor() TimeIN = Nothing TimeOUT = Nothing getDate = Nothing ElseIf TimeOUT =然后 disableTimeINColor() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing ElseIf TimeOUT<> 然后 disableTimeOutColor() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing ElseIf TimeIN =And TimeOUT =getDate =然后 disableTimeOutColor() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing End if 我尝试过: 我尝试过使用此代码 如果DateDiff(DateInterval.Hour,CDate(TimeIN),CDate(Date.Now))那么 getTimeOUT() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing 解决方案 Problem / I Want to happen1) If employee/user time in she have to wait 3 or 5 hours to time out2)if she tried to time out less than 3 or 5 hours she will get a messagebox/label that he/she have already timed in This is my codes getQuery = "SELECT dtr.time_in, dtr.date FROM dtr, employee WHERE employee.employee_id ='" & empid.Text & _ "'AND dtr.employee_id ='" & empid.Text & "' AND dtr.rfid ='" & txtRFID.Text & "' AND dtr.date ='" & Date.Now.ToString("yyyy-MM-dd") & "'" getCommand = New MySqlCommand(getQuery, MySQLConnection) getReader = getCommand.ExecuteReader If getReader.Read = True Then TimeIN = (getReader.Item("time_in").ToString) getDate = (getReader.Item("date")) End If getReader.Close() getQuery = "SELECT dtr.time_out, dtr.date FROM dtr, employee WHERE employee.employee_id ='" & empid.Text & "' AND dtr.employee_id ='" & _ empid.Text & "' AND dtr.rfid ='" & txtRFID.Text & "' AND dtr.date ='" & Date.Now.ToString("yyyy-MM-dd") & "'" getCommand = New MySqlCommand(getQuery, MySQLConnection) getReader = getCommand.ExecuteReader If getReader.Read = True Then TimeOUT = (getReader.Item("time_out").ToString) getDate = (getReader.Item("date")) End If getReader.Close() If TimeIN = "" Then disableTimeOutColor() TimeIN = Nothing TimeOUT = Nothing getDate = Nothing ElseIf TimeIN <> "" And TimeOUT <> "" And getDate = Date.Today Then TimeOUT = Nothing TimeIN = Nothing getDate = Nothing ElseIf TimeIN <> "" Then disableTimeINColor() TimeIN = Nothing TimeOUT = Nothing getDate = Nothing ElseIf TimeOUT = "" Then disableTimeINColor() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing ElseIf TimeOUT <> "" Then disableTimeOutColor() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing ElseIf TimeIN = "" And TimeOUT = "" And getDate = "" Then disableTimeOutColor() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing End IfWhat I have tried:I have tried using this codes If DateDiff(DateInterval.Hour, CDate(TimeIN), CDate(Date.Now)) Then getTimeOUT() TimeOUT = Nothing TimeIN = Nothing getDate = Nothing 解决方案 这篇关于如何在USER / EMPLOYEE超时之前设置一小时? VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-01 19:38