display data from database base on date

Nov 1 2017 3:54 PM
public ActionResult search(DateTime StartDate, DateTime enddate)
{
string EmpVisitor = @"Data Source=UTSIN-15;User ID=sa;Password=unified;Initial Catalog=EmpVisitor;MultipleActiveResultSets=True;Application Name=EntityFramework";
DataTable dtbl = new DataTable();
using (SqlConnection sqlcon = new SqlConnection(EmpVisitor))
{
sqlcon.Open();
SqlDataAdapter sqlda = new SqlDataAdapter("select * from dbo.visitordetails where Date Between '" + StartDate + "' And '" + enddate + "'", sqlcon);
sqlda.Fill(dtbl);
//return RedirectToAction("List");
}
return View(dtbl);
}
 
 
 
-------------------------------------------------------------------------
im getting the datatable empty 

Answers (4)