I try to call a stored procedure in LINQ.
web method which I try is
- [WebMethod]
- public static string search_data(DateTime fromdate, DateTime todate, string region)
- {
- try
- {
- string result = "";
-
- TrackDataEntities1 td = new TrackDataEntities1();
-
- List<griddataresult_Result> dq = new
- List<griddataresult_Result>();
- dq = td.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, object> dict = new Dictionary<string, object>();
- 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);
- }
check image
my sp return return 42 rows but when i run this code show me 577 row in table.. whereas there is not any error