public List<chartentity> chartAnalysis(string data1, string data2, string loc) { string str1 = data1; string str2 = data2; string location = loc; List<chartentity> chartinfo = new List<chartentity>(); DataSet ds4 = new DataSet(); using (SqlConnection con = new SqlConnection("Data Source=xxxx;User Id=sxxxa;Password=xxx;DataBase=xxx")) { using (SqlCommand cmd = new SqlCommand()) { //cmd.CommandText = "exec sp_AreaWiseSales_DashBoard_REP '2012-02-02','2012-07-08',1"; cmd.CommandText = " exec sp_AreaWiseSales_DashBoard_REP '" + str1 + "' ,'" + str2 + "','" + location + "'"; cmd.Connection = con; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds4); } } con.Close(); } if (ds4 != null) { if (ds4.Tables.Count > 0) { if (ds4.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds4.Tables[0].Rows) { chartinfo.Add(new ChartEntity { Name = dr["AreaName"].ToString(), value = Convert.ToInt32(dr["Amt"]) }); } } } } return chartinfo; }
$.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "Services/New.asmx/chartAnalysis", //I am calling the service here.But it is not call to the method how can i call it.There is another way to call the service method data: JSON.stringify({ data1: "2012-02-05", data2: "2012-05-05", loc: "1" }), totaldata: "{},{}", dataType: "json", success: function (Result) { Result = Result.d; var data = []; for (var i in Result) { var serie = new Array(Result[i].Name, Result[i].value); data.push(serie); } DreawChart3(data); }, });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)