Foxtable(狐表)用户栏目专家坐堂 → 根据条件导出数据的问题


  共有3064人关注过本帖树形打印复制链接

主题:根据条件导出数据的问题

帅哥哟,离线,有人找我吗?
Bin
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2014/6/24 10:40:00 [显示全部帖子]

Dim wellname As WinForm.ComboBox = e.Form.Controls("井名")
Dim layername As WinForm.ComboBox = e.Form.Controls("小层名")
Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
dlg.Filter= "Excel文件|*.xls" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
    Dim ex As New Exporter
    ex.Format = "excel"
    ex.SourceTableName = "含气量统计表" '指定导出表
    Dim Filter As String = "1=1"
    If e.Form.Controls("井名").Text > ""
        Filter = filter & " and 井名 = '" & welname.Text & "'"
    End If
    If e.Form.Controls("小层名").Text > "" Then
        Filter = Filter & " and 小层名 = '" & layername.text & "'"
    End If
    ex.Filter = Filter
    ex.filepath = dlg.FileName  '指定目标文件
    ex.Export() '开始导出
End If

 回到顶部