Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在sql数据库中一次更新GridView行_C#_Asp.net_Sql_Sql Server_Gridview - Fatal编程技术网

C# 如何在sql数据库中一次更新GridView行

C# 如何在sql数据库中一次更新GridView行,c#,asp.net,sql,sql-server,gridview,C#,Asp.net,Sql,Sql Server,Gridview,我有DLL类来调用这个表 public DataTable GetTemTableValue(string TableName) { SqlConnection conn = new SqlConnection(sConnectionString); conn.Open(); string query = "select * from " + TableName + ""; SqlCommand cmd = c

我有DLL类来调用这个表

    public DataTable GetTemTableValue(string TableName)
    {
        SqlConnection conn = new SqlConnection(sConnectionString);
        conn.Open();

        string query = "select * from  " + TableName + "";

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = query;

        DataTable ds = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(ds);
        conn.Close();

        return ds;
    }
我正在将表绑定到网格视图

    private void LoadData()
    {

        clsDataAccess objDAL = new clsDataAccess();
        DataTable DS = new DataTable();

        string objBLL = DDLTemTableList.SelectedValue.ToString();
        DS = objDAL.GetTemTableValue(objBLL);

        if (DS != null && DS.Rows.Count != 0)
        {
            lblNoRecord.Visible = false;

            foreach (DataColumn col in DS.Columns)
            {
                //Declare the bound field and allocate memory for the bound field.
                BoundField bfield = new BoundField();

                //Initalize the DataField value.
                bfield.DataField = col.ColumnName;

                //Initialize the HeaderText field value.
                bfield.HeaderText = col.ColumnName;

                //Add the newly created bound field to the GridView.
                GVDataEntry.Columns.Add(bfield);

            }


            GVDataEntry.DataSource = DS;
            GVDataEntry.DataBind();
            GVDataEntry.Visible = true;
        }
        else
        {
            lblNoRecord.Visible = true;
            GVDataEntry.DataSource = null;
            GVDataEntry.DataBind();
            //GVDataEntry.EmptyDataText = "No recorddata found";
        }
所以表正在加载到网格视图。每次我更改dropdownbox中的表并按下搜索按钮时,列都会动态更改,因此如何通过使用行编辑、行更新功能更新网格视图中的数据,并且需要将日期存储在数据库中