不得已,想了个笨法子,发现哪里更改了就只接写个sql更新语句,等对比完了执行sql语句,希望有人能提供个正常的解决办法最好了.- 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)
- Dim id As String = ""
- Dim UpSql As String = ""
- 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)
- id = DG_show.DataKeys(i)(0)
- If rowDict.ContainsKey("职务") Then
- rowData("职务") = rowDict("职务")
- UpSql += " update 部门名称 set 职务='" & rowDict("职务") & "' where id='" & id & "' "
- End If
- If rowDict.ContainsKey("序列") Then
- rowData("序列") = rowDict("序列")
- UpSql += " update 部门名称 set 序列='" & rowDict("序列") & "' where id='" & id & "' "
- End If
- If rowDict.ContainsKey("部门") Then
- rowData("部门") = rowDict("部门")
- UpSql += " update 部门名称 set 部门='" & rowDict("部门") & "' where id='" & id & "' "
- End If
- End If
- Next
- hr.ExecuteNoSQL(UpSql)
- table.Dispose()
- DG_show.DataSource = hr.GetData(sql)
- DG_show.DataBind()
- Alert.Show(UpSql)
- End Sub
复制代码 |