Click here to Skip to main content
15,887,240 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
THIS IS MY JQUERY
C#
update: function (options) {


                           $.ajax({
                               type: "POST",
                               url: url1,
                               cache: false,
                               contentType: "application/json; charset=utf-8",
                               // data: JSON.stringify($("#cid").data("grid").dataSource.select()),
                               data: "{'id':'" + $("#id").val() + "','name':'" + $("#name").val() + "','age':'" + $("#age").val() + "'}",
                               dataType: "json",
                               success: function (result) {
                                   if (result.d !== "success") {
                                       alert(result.d);
                                   }
                                   dataSource.read();

                               },
                               error: function (result) {
                                   alert(result.Id);

                               }
                           });
                           

                       },





/*THIS IS MY WEB METHOD CAN U TELL ME THE SOLUTION PLEASE */
C#
[System.Web.Services.WebMethod]
        public static string UpdateData(string id, string name,string age)
        {
            //DataSet ds = null;
            //return ds;
            string strResult = "";

            DataTable dt = new DataTable();

            SqlConnection con1 = new SqlConnection("Database=project;Data Source=.;Trusted_Connection=true");
            SqlCommand updateData = new SqlCommand();

            updateData.Connection = con1;
            updateData.CommandType = CommandType.StoredProcedure;
            updateData.CommandText = "updating";
            updateData.Parameters.Add("@id", SqlDbType.NVarChar).Value = id;
            updateData.Parameters.Add("@name", SqlDbType.NVarChar).Value = name;

            updateData.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter dataAdapter = new SqlDataAdapter();
            DataSet dataSet = new DataSet();
            dataAdapter.SelectCommand = updateData;
            dataAdapter.Fill(dataSet);
            dt = dataSet.Tables[0];
            if (dt.Rows.Count > 0)
            {

                strResult = Convert.ToString(dt.Rows[0][0]);
                //strResult = strResult.Replace("<error>", "");
                //strResult = strResult.Replace("</error>", "");
                // RenderXML(dt, strResult);
            }
            return strResult;
        }
Posted
Updated 26-May-14 5:53am
v2
Comments
Kornfeld Eliyahu Peter 26-May-14 13:37pm    
Where exactly the error occurs?
Member 9965416 26-May-14 14:03pm    
when i execute the application and click edit option then after clicking update , error is raising
Kornfeld Eliyahu Peter 26-May-14 14:04pm    
You told me when! I asked where - please use debugging...
Put a debugger inside the cod by writing debugger; inside the function. Then debug line by line in Developer Tool. See on which line exactly, you see this error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900