以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 手工编码填充问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=6061) |
||||
-- 作者:hty4000 -- 发布时间:2010/2/28 22:56:00 -- 手工编码填充问题 我想将表A中编码为a1,同时名称包含“城中”的记录复制到表B中,下面这样行不通,应该怎么样写代码呢? For Each dr1 As DataRow In DataTables("表A").Select("[编码]=a1 and [名称].contains 城中") Dim dr2 As DataRow = DataTables("表B").AddNew() For Each dc As DataCol in DataTables("表A").DataCols dr2(dc.Name) = dr1(dc.name) Next Next
|
||||
-- 作者:mr725 -- 发布时间:2010/2/28 23:33:00 -- [名称].contains 城中 => [名称] Like \'城中*\' |
||||
-- 作者:yangming -- 发布时间:2010/2/28 23:42:00 -- For Each dr1 As DataRow In DataTables("表A").Select("[编码]=\'a1\' and [名称] Like \'*城中*\'") Dim dr2 As DataRow = DataTables("表B").AddNew() For Each dc As DataCol in DataTables("表A").DataCols dr2(dc.Name) = dr1(dc.name) Next Next |
||||
-- 作者:yangming -- 发布时间:2010/2/28 23:47:00 -- 这样更好! dim f As New Filler f.SourceTable = DataTables("表A") \'指定数据来源 f.DataTable = DataTables("表B") \'指定数据接收表 f.Filter ="[编码]=\'a1\' and [名称] Like \'*城中*\'" f.Fill() \'填充数据 |