Hai all i tried this for showing records which has date after today..in mvc
}
public ActionResult ActiveRecords()
{
var dateAndTime = DateTime.Now;
var ydate = dateAndTime.Date;
DataTable dt = _obj.activeR(ydate);
return View();
}
and in my Dal.cs
internal DataTable activeR(DateTime ydate)
{
SqlConnection con = new SqlConnection(s);
SqlCommand cmd = new SqlCommand("sb_calender", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@EndDate", ydate);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);---table is not loading here
return dt;
}
finaly my stored procedure isalter proc sb_calender
@EndDate date
as
begin
select * from tb_calender WHERE @EndDate > CONVERT(DATETIME,CONVERT(NVARCHAR(10),GETDATE(),121))
end
is this the correct way to do this or anything else....if yes please help me ..
TIA
Vincent Maverick DuranoPosted Jun 28, 2016, 12:42 PM
Vinay SinghPosted Jun 27, 2016, 8:12 AM