以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]空行循环赋值 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91441) |
||||
-- 作者:铜豌豆之首 -- 发布时间:2016/10/11 1:27:00 -- [求助]空行循环赋值 如何对空行循环赋值,我写了如下代码,错误比较多,望老师指出错误,或者指点更好更简洁的方法 If e.DataRow.Isnull("姓名") = True then Dim t1 As Byte Dim t As List(Of String) = DataTables("客服目标").GetValues("姓名","月=" & Date.Today.month) Dim t3 As List(Of String) = DataTables("组合1").GetValues("姓名","月=" & Date.Today.month) t1 = t.Count Dim t5 As Integer = DataTables("组合1").DataRows.Count \'行计数 Dim t2 ,r As Integer t2 = Tables("组合1").Compute("count(姓名)","姓名 Is Not Null") \'非空计数 For r = 0 To t5 - t2 Dim dr As DataRow dr = DataTables("组合1").Find("[月] Is null",,r) For Each t6 As String In t dr("姓名") = t(r) Next Next End If
[此贴子已经被作者于2016/10/11 1:29:35编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2016/10/11 8:40:00 -- 没有看懂你的逻辑。 假如姓名为空,应该给什么值呢?麻烦下次给代码的时候详细说明操作逻辑
|
||||
-- 作者:铜豌豆之首 -- 发布时间:2016/10/11 10:51:00 --
|
||||
-- 作者:有点蓝 -- 发布时间:2016/10/11 11:20:00 -- 请上例子测试 |
||||
-- 作者:铜豌豆之首 -- 发布时间:2016/10/11 11:35:00 -- 实例文件
|
||||
-- 作者:有点蓝 -- 发布时间:2016/10/11 11:52:00 -- Dim t As List(Of String) = DataTables("客服目标").GetValues("姓名","月=" & Date.Today.month) \'姓名写入集合 Dim maxdate = DataTables("组合1").Compute("max(日期)") If maxdate IsNot Nothing Then Dim days As Integer = (Date.Today - cdate(maxdate)).TotalDays If days > 0 Then Dim dr As DataRow For Each name As String In t For i As Integer = 1 To days dr = DataTables("组合1").AddNew dr("姓名") = name dr("日期") = maxdate.AddDays(i) Next Next End If End If
|