public int getdayforstaffattandence1(DateTime date) { try { Dob.open(); cm = new SqlCommand(); cm.CommandType = CommandType.StoredProcedure; cm.CommandText = "sp_getdayforstaffattandence"; cm.Parameters.Add(new SqlParameter("@date", date)); cm.Connection = Dob.con; dr = cm.ExecuteReader(); int timeid=0; if (dr.HasRows) { timeid =Convert.ToInt32( dr[0].ToString()); } return timeid; } catch (SqlException ex) { throw ex; } finally { if (Dob.con != null) { Dob.close(); } }
alter procedure sp_getdayforstaffattandence(@date datetime) as set nocount on begin declare @dates date set @dates=CONVERT(date,@date,111) select Time_id from Workingday_details where Working_date=@dates end
Invalid attempt to read when no data is present.
if (dr.Read()) { timeid = Convert.ToInt32( dr[0].ToString()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)