Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共13 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:移出行问题

1楼
wqc360 发表于:2010/8/7 19:35:00

DataTables("订单").DataRows(0).Remove()

请问移除表A第一列不为空的行代码应该怎么写,谢谢

2楼
qtcks 发表于:2010/8/7 20:46:00

If DataTables("订单").DataRows(0)("第一列") <> Nothing Then
DataTables("订单").DataRows(0).Remove()
End If

[此贴子已经被作者于2010-8-7 20:48:16编辑过]
3楼
kylin 发表于:2010/8/7 21:05:00

If DataTables("订单").isnull("第一列")= False Then
DataTables("订单").DataRows(0).Remove()
End If

这样会更好
4楼
wqc360 发表于:2010/8/7 21:10:00
谢谢2为老师
5楼
wqc360 发表于:2010/8/7 21:17:00
我的代码是用在窗口按钮中,怎么2楼的提示出错,好像第一句语法有问题。谢谢
6楼
czy 发表于:2010/8/7 21:30:00

Dim dt As Table = Tables("表A")
Dim r As Integer
Dim drs As List(Of DataRow) = DataTables("表A").Select("[第一列] Is Not Null")
For n As Integer = 0 To drs.Count -1
    r = dt.FindRow("[第一列] = '" & drs(n)("第一列") & "'", dt.Position + 1, True )
    If r >= 0 Then
    DataTables("表A").DataRows(r).Remove()
    End If
Next

 

7楼
czy 发表于:2010/8/7 21:36:00

楼上的代码少考虑了一个问题,改成这样:

 

Dim dt As Table = Tables("表A")
Dim r As Integer
Dim drs As List(Of DataRow) = DataTables("表A").Select("[第一列] Is Not Null","_Identify")
For n As Integer = 0 To drs.Count -1
    r = dt.FindRow("[第一列] = '" & drs(n)("第一列") & "'", dt.Position + 1, True )
    If r >= 0 Then
    DataTables("表A").DataRows(r).Remove()
    End If
Next

8楼
wqc360 发表于:2010/8/7 22:01:00
谢谢C版
9楼
狐狸爸爸 发表于:2010/8/7 22:09:00

一行就行:

 

DataTables("xxx").RemoveFor("条件表达式")

 

图片点击可在新窗口打开查看

10楼
czy 发表于:2010/8/7 22:15:00
以下是引用狐狸爸爸在2010-8-7 22:09:00的发言:

一行就行:

 

DataTables("xxx").RemoveFor("条件表达式")

 

图片点击可在新窗口打开查看

 

nnd,别都烂在肚里

共13 条记录, 每页显示 10 条, 页签: [1] [2]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 2 queries.