如何通过代码来实现如下功能:选定某一个表的一行数据,双击数据行头实现选定行自动添加到另外一张表数据中
http://www.foxtable.com/webhelp/topics/2929.htm
DoubleClickRowHeader事件
Dim Cols1() As String = {"来源列一","来源列二","来源列三"}
Dim Cols2() As String = {"接收列一","接收列二","接收列三"}
Dim dr2 As DataRow = DataTables("另外一张表").AddNew()
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = e.row(Cols1(i))
Next
谢谢!如何判断是否重复,如果重复了(需要添加的数据表已经有了该条记录)就不添加,不重复就追加。
先使用find查一下:
http://www.foxtable.com/webhelp/topics/0396.htm
Dim dr As DataRow
dr = DataTables("另外一张表").Find("编号 ='" & e.row("编号") & "'")
If dr Is Nothing Then '如果没有找到的话
Dim Cols1() As String = {"来源列一","来源列二","来源列三"}
Dim Cols2() As String = {"接收列一","接收列二","接收列三"}
dr = DataTables("另外一张表").AddNew()
For i As Integer = 0 To Cols1.Length -1
dr(Cols2(i)) = e.row(Cols1(i))
Next
End If