以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]GetValues连空行也统计了  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=79702)

--  作者:poiokm26
--  发布时间:2016/1/7 15:41:00
--  [求助]GetValues连空行也统计了
Dim Products As List(Of String)
Dim aa As DataRow
Dim b As Integer
Dim i As Integer

Products = DataTables("产品").GetValues("产品名称")
b=products.Count

Output.show(b)
For i=0 To b
aa=DataTables("产品").DataRows(i)
\'If aa("产品编号") Is Nothing Then            //用Nothing没有动静。
If aa("产品编号") IsNot Nothing Then       //有反应,但是Nothing的行也有变化
aa("测试")=1111
‘aa("测试")=Nothing
\'DataTables("产品").DataRows(i).Delete()    //如果执行这句就会弹出错误信息。
End If
Next

\'For Each Product As String In Products 
    \'Output.Show(Product)
\'Next



///最后问题,我原来的目标是想删除空行的。(新手入门,学了后面的忘了前面。不知道怎么删除。)


--  作者:大红袍
--  发布时间:2016/1/7 15:43:00
--  
Products = DataTables("产品").GetValues("产品名称", "产品名称 is not null")
--  作者:大红袍
--  发布时间:2016/1/7 15:44:00
--  

删除空行就一句代码

 

DataTables("产品").DeleteFor("产品名称 is null")


--  作者:poiokm26
--  发布时间:2016/1/7 16:02:00
--  
谢谢老师。

还想问一下关于“测试”列
Nothing和Isnot Nothing一个有反应一个没后应的原因

--  作者:大红袍
--  发布时间:2016/1/7 16:29:00
--  

判断为空这样写

 

http://www.foxtable.com/help/topics/1470.htm