Rss & SiteMap

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

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

标题:[求助]华海仓库的报表查询窗口的问题!

1楼
gaoyong30000 发表于:2011/12/10 22:12:00

其报表查询 窗口的 查询按钮有段代码

 

With e.form
    Dim sql,str1,str2,str3,kz As String
    kz = "TextBox4,ComboBox4,ComboBox3,ComboBox5,ComboBox6,TextBox1,TextBox3,DateTimePicker1,DateTimePicker2"
    str1 = "单号='@$0',类型= '@$1',仓库= '@$2',供应单位= '@$3',经办人= '@$4',货品编码 = '@$5',部门= '@$6',日期 >= #@$7#,日期 <= #@$8#"
    Dim i As Integer
    For Each k As String In kz.split(",")
        If .Controls(k).Value IsNot Nothing Then
            If i=0 And .Controls("CheckBox1").Checked Then
                sql = sql & " AND " & str1.split(",")(i).Replace("='@$" & i," like '%" & .Controls(k).Value & "%")
            Else
                sql = sql & " AND " & str1.split(",")(i).Replace("@$" & i,.Controls(k).Value)
            End If
        End If
    i += 1
    Next
    Dim cmd As New SQLCommand
    cmd.C
    Dim dst As Table = Tables("窗口1_Table7")   
    cmd.CommandText = Vars("str2").Replace("@#$",sql)
    dst.DataSource  = cmd.ExecuteReader()
    For i=1 To dst.count
        Dim dr As Row = dst.Rows(i-1)
        dr("序号") = "" & i
    Next
    dst.AutoSizeCols()
End With

 

其它都懂 就偏偏这个 str2 百思不得其解  哪里定义的?  照字面意思 cmd.CommandText = Vars("str2").Replace("@#$",sql)  是做筛选用的  类似于 select 

 

这怎么弄的 最后和select一样的效果!

[此贴子已经被作者于2011-12-10 22:11:57编辑过]
2楼
e-png 发表于:2011/12/10 22:18:00
是全局变量。
3楼
gaoyong30000 发表于:2011/12/10 22:31:00

没有的把 全局变量 我没查到有!

4楼
狐狸爸爸 发表于:2011/12/10 23:49:00

全局变量除了通过菜单定义,也可以通过代码增加的。

5楼
gaoyong30000 发表于:2011/12/11 8:58:00

作者代码里  有170个str2

头都晕了 不知道是哪个~

6楼
狐狸爸爸 发表于:2011/12/11 9:12:00
搜索Vars.Add
共6 条记录, 每页显示 10 条, 页签: [1]

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

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