I try to call storerprocedure in LINQ but this show error
What I have tried:
[WebMethod]
public static string search_data(DateTime fromdate, DateTime todate, string region)
{
try
{
string result = "";
Ts1 ts = new Ts1();
List<ts1> dq = ts.griddataresult(fromdate, todate, region).ToList();
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Owner", typeof(string));
foreach (var c in dq)
{
dt.Rows.Add(c.ID, c.owner);
}
result = DataSetToJSON(dt);
return result;
}
catch (Exception)
{
throw new Exception();
}
}
public static string DataSetToJSON(DataTable dt)
{
Dictionary<string,> dict = new Dictionary<string,>();
object[] arr = new object[dt.Rows.Count + 1];
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
arr[i] = dt.Rows[i].ItemArray;
}
dict.Add("response", arr);
JavaScriptSerializer json = new JavaScriptSerializer();
return json.Serialize(dict);
}