Rss & SiteMap

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

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

标题:筛选后如何生成一个新的数据表

1楼
老有所乐 发表于:2008/11/10 17:49:00

with e.Form
    Dim cmd As New SQLCommand  
    Dim dt As DataTable   
    Dim cmb1 As WinForm.ComboBox  
    Dim cmb2 As WinForm.ComboBox  
    cmb1 = .Controls("ComboBox1")  
    cmb2 = .Controls("ComboBox2") 
    If DataTables("员工资料").DataCols(cmb2.Value). IsDate  Then  
        If .Controls("DateTimePicker1").Value Is Nothing Orelse .Controls("DateTimePicker2").Value Is Nothing Then 
            Messagebox.Show("请输入完整日期","提示") 
            Return 
        End If
        cmd.CommandText = "Select * from {员工资料} where " & cmb2.Value & " BETWEEN #" & .Controls("DateTimePicker1").Value & "# AND #"  & .Controls("DateTimePicker2").Value & "#"  ''
    Else
        cmd.CommandText = "Select * from {员工资料} where " & cmb2.Value & " = '" & cmb1.Value & "'"
    End If
    dt = cmd.ExecuteReader() 
    Dim dst As WinForm.DataList = .Controls("DataList1")  
    dst.DataTable = dt
    dst.Build()
    .Controls("Label2").Text = dst.Count 
end with


上面是一个筛选按钮代码,请教,筛选后如何将筛选出的数据生成一个新的数据表。

[此贴子已经被作者于2008-11-10 17:50:34编辑过]
2楼
狐狸爸爸 发表于:2008/11/10 17:56:00
with e.Form
    Dim query As New QueryBuilder
    Dim dt As DataTable   
    Dim cmb1 As WinForm.ComboBox  
    Dim cmb2 As WinForm.ComboBox  
    cmb1 = .Controls("ComboBox1")  
    cmb2 = .Controls("ComboBox2") 
    If DataTables("员工资料").DataCols(cmb2.Value). IsDate  Then  
        If .Controls("DateTimePicker1").Value Is Nothing Orelse .Controls("DateTimePicker2").Value Is Nothing Then 
            Messagebox.Show("请输入完整日期","提示") 
            Return 
        End If
        query.SelectString  = "Select * from {员工资料} where " & cmb2.Value & " BETWEEN #" & .Controls("DateTimePicker1").Value & "# AND #"  & .Controls("DateTimePicker2").Value & "#"  ''
    Else 
        query.SelectString = "Select * from {员工资料} where " & cmb2.Value & " = '" & cmb1.Value & "'"
    End If
   query.Build
end with
3楼
老有所乐 发表于:2008/11/10 19:21:00

劳驾贺老师了,此代码好像没有反应,请看查询表窗口的“筛选生成新表”按钮。

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管.table

[此贴子已经被作者于2008-11-10 19:24:49编辑过]
4楼
老有所乐 发表于:2008/11/10 19:41:00

要加两句代码,已经搞定。

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

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

Powered By Dvbbs Version 8.3.0
Processed in .02734 s, 3 queries.