有关C#Windows App的帮助 [英] Help Regarding C# Windows App
问题描述
我正在制作一个考勤管理系统,它具有一个名为tblattendance的表,并且具有四个字段:
名称nvarchar(100)
timearrive nvarchar(100)允许为null
timeleave nvarchar(100)允许为null
登录代码nvarchar(100)
签入时,我从数据库中检查此人是否已签入,如果是,则他已签出,否则他已签入.
出现的问题是,当我在结帐时检查timeleave时,如果有人已经结帐(即timeleave!="),然后显示一个消息框,则将其签出,则出现异常表"tblattendance"是DBNull."
I am making an attendance management system, it has a table named tblattendance and has four fields:
name nvarchar(100)
timearrive nvarchar(100) allow null
timeleave nvarchar(100) allow null
logincode nvarchar(100)
At time of check in, I check from database whether or not this person already checkedin,if yes he is checkedout else he checked in.
The problem arising is that when I check for timeleave at time of checkout that if person already checked out(i.e timeleave != "") then show a message box else check him out, exception is arising "The value for column "timeleave" in table "tblattendance" is DBNull."
if (a.GetAttendbyDt(uid, day)[0].TimeLeave != "")
{
//show message
}
else
//update attendance(check out)
GetAttendbyDT方法以用户名和当前日期为参数返回数据表.
谁能解决这个问题?
the GetAttendbyDT method returns a datatable by taking userid and current date as parameters.
Can any one solve this problem? How can I check for time leave null or not?
推荐答案
在其中键入Timelaeve!="的地方,而不是writeTimeleave!= NULL
Where you are typing Timelaeve != "", instead writeTimeleave != NULL
试试这个
if (a.GetAttendbyDt(uid, day)[0].TimeLeave.ToString().Trim() != "")
这篇关于有关C#Windows App的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!