以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [讨论] 怎么数据表查询筛选后的行数 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=69552) |
-- 作者:wangyinming -- 发布时间:2015/6/7 8:59:00 -- [讨论] 怎么数据表查询筛选后的行数 源代码是这样的,但是查询的是所有数据的行,各位大侠指教。 Dim gx As WinForm.ComboBox = e.Form.Controls("工序") Dim filter As String = "1=1" If gx.Text > "" Then filter &= " and 工程 = \'" & gx.Text & "\'" End If With e.Form.Controls("开始日期") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "作业日期 >= #" & .Value & "#" End If End With With e.Form.Controls("结束日期") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "作业日期 <= #" & .Value & "#" End If End With Tables("检查").Filter = filter Dim pr As Integer = DataTables("检查").DataRows.Count \'查询表行数 Dim Book As New XLS.Book(ProjectPath & "Attachments\\报表1.xls") Dim fl As String = ProjectPath & "Reports\\报表1.xls" Dim Sheet As XLS.Sheet = Book.Sheets(0) Sheet(3,9).Value = "<" & Tables("检查").Filter & ">" \'写入打印条件 Book.Build() \'生成细节区 Book.Save(fl) \'保存工作簿 If MessageBox.Show("成功导入数据"& pr &"条,是否打开数据?","确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) =DialogResult.OK Then Dim Proc As New Process Proc.File = fl Proc.Start() Else Syscmd.Table.ToggleSortAndFilter() e.Form().Close End If |
-- 作者:大红袍 -- 发布时间:2015/6/7 9:09:00 -- Dim pr As Integer = Tables("检查").DataRows.Count |
-- 作者:wangyinming -- 发布时间:2015/6/7 9:17:00 -- 不行啊,显示DataRows不属于Table |
-- 作者:wangyinming -- 发布时间:2015/6/7 9:39:00 -- Dim pr As Integer = Tables("检查").DataRows.Count 不可以用啊? 提示:DataRows不是Tables的成员
|
-- 作者:大红袍 -- 发布时间:2015/6/7 10:14:00 -- Dim pr As Integer = Tables("检查").Rows.Count |