在DataView中更新数据 [英] updating data in DataView

查看:436
本文介绍了在DataView中更新数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用dataview将数据更新到后端

请尽快告诉我..

how to update data into back-end using dataview
Please tell me soon ..

推荐答案

试试这个..

DataView可用于修改DataTable中的实际内容。它意味着添加新行,排序和搜索表。

try this..
DataView can be used to modify the actual content in a DataTable.It means adding new rows, sorting and search a table.
con.Open();
       string query = "select * from tab2";
       SqlDataAdapter da = new SqlDataAdapter(query, con);
       con.Close();
       DataSet ds = new DataSet();
       DataView dv = new DataView();
       da.Fill(ds);
       dv = new DataView(ds.Tables[0],"", "name", DataViewRowState.CurrentRows);
       int index = dv.Find("ddd");

       if (index == -1)
       {
       }
       else
       {
           dv[index]["name"] = "aaa";
       }

       grdview.DataSource = (DataTable)dv.ToTable();
       grdview.DataBind();


这篇关于在DataView中更新数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆