本文介绍了我没有得到任何错误,但在Gridview中没有更新值我检查调试它显示只有旧值不显示更新值...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨frds请帮帮我..

我没有收到任何错误但是在gridview中没有更新值我检查调试它的显示只有旧值不显示更新值...

Hi frds please help for me..
I am not getting any error but value is not updated in gridview i check with debug its shows only old value not show update value...

protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {


        GridViewRow row = (GridViewRow)GridView2.Rows[e.RowIndex];
        int BookingRefNo=int.Parse(GridView2.DataKeys[e.RowIndex].Value.ToString());

        string AssignedPriority = ((TextBox)row.Cells[11].Controls[0]).Text;
        string Status = ((TextBox)row.Cells[12].Controls[0]).Text;



        SqlConnection con1 = new SqlConnection(constr);
        SqlCommand cmd = new SqlCommand("Update TSafetyMaster set AssignedPriority=@AssignedPriority,Status=@Status where BookingRefNo=@BookingRefNo", con1);
        cmd.Parameters.Add("@BookingRefNo", SqlDbType.Int).Value = BookingRefNo;
        cmd.Parameters.Add("@AssignedPriority", SqlDbType.VarChar).Value = AssignedPriority;
        cmd.Parameters.Add("@Status", SqlDbType.NVarChar).Value = Status;
        con1.Open();
        cmd.ExecuteNonQuery();
        GridView2.EditIndex=-1;
        GridView2.DataBind();



    }

推荐答案


这篇关于我没有得到任何错误,但在Gridview中没有更新值我检查调试它显示只有旧值不显示更新值...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 01:28