2
Answers

datatable is not loading

aditya immadi

aditya immadi

8y
255
1
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 is
 
alter 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 
 
Answers (2)