Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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)

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?
Posted
Updated 8-Dec-10 0:41am
v4

Where you are typing Timelaeve != "", instead writeTimeleave != NULL
 
Share this answer
 
Comments
Rajesh Anuhya 8-Dec-10 6:44am    
:)
Try this
if (a.GetAttendbyDt(uid, day)[0].TimeLeave.ToString().Trim() !=  "")
 
Share this answer
 
Comments
Syed Salman Raza Zaidi 8-Dec-10 6:49am    
Doesnt work still showing the same exception

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900