以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 批量填入列内容的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=88063) |
-- 作者:douglas738888 -- 发布时间:2016/7/26 10:41:00 -- 批量填入列内容的问题 请教老师,我想实现,从不绑定的COMBOBOX中选择人名后,TABLE的审批人员,根据编号批量填入,下面代码转换不过来STRING Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox1") Dim dr As DataRow = cmb.SelectedItem cmb.Value = dr For Each r As Row In Tables("线路主表.线路二级明细").Rows If r("一级编号") = Tables("线路主表.线路二级明细").Current("一级编号") Then r("审批人员") = cmb Next |
-- 作者:大红袍 -- 发布时间:2016/7/26 10:43:00 -- Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox1")
For Each r As Row In Tables("线路主表.线路二级明细").Rows
If r("一级编号") = Tables("线路主表.线路二级明细").Current("一级编号") Then r("审批人员") = cmb.Text
Next |
-- 作者:douglas738888 -- 发布时间:2016/7/26 12:03:00 -- 再请教老师,如果项目编号下 已经审核通过的文件(单文件属性),想点击按钮批量逐行增加到另一个文件档案表中(逐行增加),下面代码写的还有问题 Dim r1 As Row = Tables("线路二级明细").Current Dim r2 As Row = Tables("线路二级明细").AddNew For Each c As Col In Tables("线路二级明细").Cols If c.name <> "项目编号" Then r2(c.name) = r1(c.name) End If Next Dim val As String =DataTables("线路二级明细").Compute("Max(项目编号)") \'val = val.SubString(2) For Each dr1 As Row In Tables("档案") Dim dr2 As Row = Tables("档案").AddNew() For Each dc As Col In Tables("档案").Cols If dc.name <> "项目编号" Then dr2(dc.name) = dr1(dc.name) End If dr2("上传文件") = r2("上传文件") Next Next [此贴子已经被作者于2016/7/26 12:33:57编辑过]
|
-- 作者:大红袍 -- 发布时间:2016/7/26 12:51:00 -- 没理解你的逻辑,根据什么,把什么表的什么内容填充到哪里去? |
-- 作者:douglas738888 -- 发布时间:2016/7/26 12:57:00 -- 老师,我这么写了个例子,能实现部分功能了,但是还有点问题 如果满足条件 审批完成=TRUE和入档=TRUE 把线路二级明细里面的上传文件等等 添加到档案表里面,还存在以下问题: 问题:已勾选 入档 的就不再重复添加到 档案 表 里面了, 现在会重复添加 Dim Cols1() As String = {"项目编号","项目名称","文件名称","上传文件"} Dim Cols2() As String = {"项目编号","项目名称","文件名称","上传文件"} For Each dr1 As DataRow In DataTables("线路二级明细").Select("[审批完成] = True and [入档]=true ") Dim dr2 As Row = Tables("档案").AddNew For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next [此贴子已经被作者于2016/7/26 13:56:17编辑过]
|
-- 作者:大红袍 -- 发布时间:2016/7/26 14:22:00 -- Dim Cols1() As String = {"项目编号","项目名称","文件名称","上传文件"} Dim Cols2() As String = {"项目编号","项目名称","文件名称","上传文件"} For Each dr1 As DataRow In DataTables("线路二级明细").Select("[审批完成] = True and [入档]=true ") Dim dr2 As DataRow = DataTables("档案").find("项目编号 = \'" & dr1("项目编号") & "\' and 文件名称 = \'" & dr1("文件名称") & "\'") If dr2 Is Nothing Then dr2 = DataTables("档案").AddNew End If For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next |