以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 引用数据 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=101266) |
-- 作者:zhangning -- 发布时间:2017/5/27 13:39:00 -- 引用数据 此主题相关图片如下:45.png 如图,已知父产品的时间,想将其”子集结日“引入子产品的”子集结日“里去, 父产品:If dr13.IsNull("部组名") = False AndAlso dr13.IsNull("部品ID") = True 子产品:If dr13.IsNull("部组名") = False AndAlso dr13.IsNull("部品ID") = False 写了以下代码,不对,请老师帮看看,谢谢! Dim dr13 As DataRow = e.DataRow If dr13.IsNull("部组名") = False AndAlso dr13.IsNull("部品ID") = True dr13("子集结日") = dr13("第1序_配膳日").AddDays(-1) Dim d1 As Date = e.DataRow("子集结日") If d1.DayOfWeek = 0 Then dr13("子集结日") = dr13("第1序_配膳日").AddDays(-2) End If End If If dr13.IsNull("部组名") = False AndAlso dr13.IsNull("部品ID") = False Dim d2 As Date = e.DataRow("子集结日") d2("子集结日") = d1("子集结日") End If |
-- 作者:有点蓝 -- 发布时间:2017/5/27 15:13:00 -- Select Case e.DataCol.Name Case "第1序_配膳日" Dim dr13 As DataRow = e.DataRow If dr13.IsNull("部组名") = False AndAlso dr13.IsNull("部品ID") = True Dim d1 As Date = dr13("第1序_配膳日").AddDays(-1) If d1.DayOfWeek = 0 Then d1 = dr13("第1序_配膳日").AddDays(-2) End If dr13("子集结日") = d1 End If Case "子集结日" Dim dr13 As DataRow = e.DataRow If dr13.IsNull("部组名") = False AndAlso dr13.IsNull("部品ID") = True AndAlso dr13.IsNull("子集结日") = False e.DataTable.ReplaceFor("子集结日",e.DataRow("子集结日"),"部组名=\'" & dr13("部组名") & "\' And 部品ID Is not null") End If End Select
|
-- 作者:zhangning -- 发布时间:2017/5/27 15:50:00 -- 完美导入,谢谢老师,提前祝老师 端午节快乐! |
-- 作者:zhangning -- 发布时间:2017/5/31 9:54:00 -- 老师,我如果想在条件中加入: 类别列内容如是“计划”就引入, 将 e.DataTable.ReplaceFor("子集结日",e.DataRow("子集结日"),"部组名=\'" & dr13("部组名") & "\' And 部品ID Is not null") 改为e.DataTable.ReplaceFor("子集结日",e.DataRow("子集结日"),"部组名=\'" & dr13("部组名") & "\' And 部品ID Is not null and 类别 ="计划"") 提示错误:应为逗号、”)“或有效的表达式继续符, 请老师帮看看,错在哪里了?谢谢!
|
-- 作者:有点色 -- 发布时间:2017/5/31 10:48:00 --
e.DataTable.ReplaceFor("子集结日",e.DataRow("子集结日"),"部组名=\'" & dr13("部组名") & "\' And 部品ID Is not null and 类别 =\'计划\'")
http://www.foxtable.com/webhelp/scr/1647.htm
|