在你绑定到datagrid的代码种为datatable添加新行啊!
ds是你定义的
DataTable dt=ds.Tables["你的表名"];
DataRow newrow=dt.NewRow();
...
DataGrid1.DataSource=dt.DefaultView;
ds是你定义的
DataTable dt=ds.Tables["你的表名"];
DataRow newrow=dt.NewRow();
...
DataGrid1.DataSource=dt.DefaultView;
解决方案 »
- flasfxp 的使用
- datalist分页
- 各位大侠,怎么得到datagrid 控件的数据源
- 关于一个空间中的bin文件夹问题(vs2005)
- 請教一個用vb.net進行web開發的問題
- 自动获取网页内容的程序该怎么做?
- oledb链接sql server 2000出错,在:[DBNETLIB][ConnectionOpen (ParseConnectParams()).]无效的连接。
- 请教各位大侠,如果多表更新?
- .net framework sdk的安装问题
- redis的问题
- 沈阳的或本溪的GGDDJJMM,请进,我有事问
- System.Web.UI.Page! 有关WebForm 的继承的问题,就是WEB 模板!我想建一个webForm1 它是public webform1:myNameSpace.baseform.Page 这样
Dim da As New OleDbDataAdapter("select * from log", cnn)
Dim ds As New DataSet()
da.Fill(ds, "employees")
Dim tb As DataTable = New DataTable()
tb = ds.Tables(0)
Dim dr As DataRow = tb.NewRow dr(1) = ds.Tables(0).Rows(0).Item(1).ToString
dr(2) = ds.Tables(0).Rows(0).Item(2).ToString
dr(3) = ds.Tables(0).Rows(0).Item(3).ToString tb.Rows.Add(dr)
Dim dw As DataView = New DataView(tb) DataGrid1.DataSource = dw
DataGrid1.DataBind()
Session("dw") = dw
Else
Dim dw As DataView = New DataView()
dw = Session("dw")
Dim tb As DataTable = New DataTable()
tb = dw.Table
Dim dr As DataRow = tb.NewRow dr(1) = dw.Table.Rows(0).Item(1).ToString
dr(2) = dw.Table.Rows(0).Item(2).ToString
dr(3) = dw.Table.Rows(0).Item(3).ToString tb.Rows.Add(dr) DataGrid1.DataSource = dw
DataGrid1.DataBind()
Session("dw") = dw
End If
我的窗体上本来就有一个datagrid,而且不是动态产生的,也已经从数据源绑定过了,
现在我不想把数据直接保存到数据库里面,想先在datagrid里面手写进去,像是缓存一样,最后一块写入数据库,谢谢~~~~~~~~~````
....
while(dsTemp.Tables[0].Rows.Count<6)
{
DataRow dr;
dr=dsTemp.Tables[0].NewRow();
dsTemp.Tables[0].Rows.InsertAt(dr,(dsTemp.Tables[0].Rows.Count));
}
dgd.DataSource=dsTemp;
dgd.DataBind();
//以上代码是当datagrid行少于6行时,增加到6行,如果只增加一行,就把while改成if