ASP.NET修改后的数据在页面上没有实时更新

{
    string connStr = @"Data Source=LAPTOP-LJNT4FF8;Initial Catalog=SMSstudent;;User ID=sa;pwd=123";
    SqlConnection conn = new SqlConnection(connStr);
    conn.Open();


    string commStr = "update student set studentID='" + studentID.Text.Trim() + "',studentName='" + studentName.Text.Trim() + "',nation='" + nation.Text.Trim() + "',sex='" + sex.Text.Trim() + "',birthday='" + birthday.Text.Trim() + "',telephone='" + telephone.Text.Trim() + "',credithour='" + credithour.Text.Trim() + "',address='" + address.Text.Trim() + "' where studentID='" + studentID.Text.Trim() + "'";

    SqlCommand comm = new SqlCommand(commStr, conn);
    SqlDataAdapter da = new SqlDataAdapter(comm);
    try
    {
        DataSet ds = new DataSet();
        da.Fill(ds);

        this.GridView1.DataSource = ds.Tables[0];
        this.GridView1.DataBind();

        
        comm.ExecuteNonQuery();
      

    }
    catch { }
    SqlHelper.ExcuteNonQuery(CommandType.StoredProcedure, "InsertOrUpdate", null);
    Response.Write("<script>alert('录入成功')</script>");
    conn.Close();
}

点击修改后,数据是修改好了,但是页面没有事实更新,应该怎么修改

你好,
你的gridview 需要重新绑定数据库.
像这样:

protected void bind()  
    {  
        dt = new DataTable();  
        con = new SqlConnection(cs);  
        con.Open();  
        adapt = new SqlDataAdapter("Select ID,Name,City from tbl_Employee",con);  
        adapt.Fill(dt);  
        if(dt.Rows.Count>0)  
        {  
            GridView1.DataSource = dt;  
            GridView1.DataBind();  
        }  
        con.Close();  
    } 

 protected void update()  
    {  
       string connStr = @"Data Source=LAPTOP-LJNT4FF8;Initial Catalog=SMSstudent;;User ID=sa;pwd=123";
    SqlConnection conn = new SqlConnection(connStr);
    conn.Open();
    string commStr = "update student set studentID='" + studentID.Text.Trim() + "',studentName='" + studentName.Text.Trim() + "',nation='" + nation.Text.Trim() + "',sex='" + sex.Text.Trim() + "',birthday='" + birthday.Text.Trim() + "',telephone='" + telephone.Text.Trim() + "',credithour='" + credithour.Text.Trim() + "',address='" + address.Text.Trim() + "' where studentID='" + studentID.Text.Trim() + "'";
 
    SqlCommand comm = new SqlCommand(commStr, conn);
        comm .ExecuteNonQuery();  
        con.Close();  
        bind();     // 重新绑定gridview
    }  

新的数据填充的是数据库修改结果,应该要修改之后重新请求student表,绑定到this.GridView1.DataSource

img