Sukhada Vader

Sukhada Vader

  • NA
  • 64
  • 28.5k

Convert List to sql parameters

Jan 24 2019 1:19 AM
I am doing one project in MVC using SQL helper class.when i passes formcollection to stored procedure through jquery then there is an error that cannot convert generic list to sql parameters please help me.
my method is as follows,
 
[HttpPost] 
public ActionResult SaveNotification(FormCollection formdata)
{
List sqlParameters = new List();
sqlParameters.Add(new SqlParameter("@NotificationID", formdata["NotificationID"]));
sqlParameters.Add(new SqlParameter("@ToDate", formdata["ToDate"]));
sqlParameters.Add(new SqlParameter("@FromDate", formdata["FromDate"]));
return PartialView("~/Views/Notifications/Index.cshtml", (new DBHelper().ExecuteNonQuery("SPName", sqlParameters)));
}
 

Answers (1)