标题: Grid编辑单元格后无法保存,求解决 [打印本页] 作者: 夜冰 时间: 2013-7-14 16:13 标题: Grid编辑单元格后无法保存,求解决 Protected Sub Btn_save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn_save.Click
Dim modifiedDict As Dictionary(Of Integer, Dictionary(Of String, String)) = DG_show.GetModifiedDict
Dim count As Integer = DG_show.Rows.Count
Dim sql As String = H_sql.Text
Dim table As DataTable = hr.GetTable(sql)
For i = 0 To count - 1
If (modifiedDict.ContainsKey(i)) Then
Dim rowDict As Dictionary(Of String, String) = modifiedDict(i)
Dim rowData As DataRow = table.Rows(i)
If rowDict.ContainsKey("职务") Then
rowData("职务") = rowDict("职务")
End If
If rowDict.ContainsKey("序列") Then
rowData("序列") = rowDict("序列")
End If
End If
Next
DG_show.DataSource = hr.GetData(sql)
DG_show.DataBind()
End Sub
例子里是把数据存在session中了,没有看明白,哪位给个存到数据库的例子啊......