Foxtable(狐表)用户栏目专家坐堂 → 代码优化


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

主题:代码优化

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


加好友 发短信
等级:婴狐 帖子:68 积分:590 威望:0 精华:0 注册:2015/3/28 19:58:00
代码优化  发帖心情 Post By:2015/6/14 14:47:00 [只看该作者]


此主题相关图片如下:111.png
按此在新窗口浏览图片

此主题相关图片如下:222.png
按此在新窗口浏览图片
这个条件加载的思路是怎么样做的
Dim kh As String = e.Form.Controls("ComboBox1").Value
Dim hp As String = e.Form.Controls("ComboBox2").Value
Dim ywy As String = e.Form.Controls("ComboBox3").Value
Dim b As New SQLJoinTableBuilder("查询表1","O_Sale1Detail")
b.C
b.AddTable("O_Sale1Detail","GoodsId","B_Goods","GoodsId") '添加统计表
b.AddTable("O_Sale1Detail","BillNo","O_Sale1","BillNo") '添加统计表
b.AddTable("B_Goods","TypeCode","B_GoodsType","Code") '添加统计表
b.AddTable("O_Sale1","ClientID","B_Client","ClientId")
b.AddTable("O_Sale1","ExeManID","B_Employ","EmployID")
b.AddExp("单据编号","{O_Sale1Detail}.BillNo")
b.AddExp("客户代码","{B_Client}.Code")
b.AddExp("客户名称","{B_Client}.Name")
b.AddExp("货品代码","{B_Goods}.Code")
If kh IsNot Nothing And hp IsNot Nothing And ywy IsNot Nothing Then
    b.filter = "{B_Employ}.Name = '" & ywy & "' and {B_Client}.Name = '" & kh & "' and {O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " ' and {B_Goods}.Name = '" & hp & "' "
Else
    If kh IsNot Nothing And ywy IsNot Nothing Then
        b.filter = "{B_Employ}.Name = '" & ywy & "' and {B_Client}.Name = '" & kh & "' and {O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " ' "
    Else
        If ywy IsNot Nothing And hp IsNot Nothing Then
            b.filter = "{B_Employ}.Name = '" & ywy & "' and {O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " ' and {B_Goods}.Name = '" & hp & "' "
        Else
            If kh IsNot Nothing And hp IsNot Nothing Then
                b.filter = "{B_Client}.Name = '" & kh & "' and {O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " ' and {B_Goods}.Name = '" & hp & "' "
            Else
                If ywy IsNot Nothing Then
                    b.filter = "{B_Employ}.Name = '" & ywy & "' and {O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " '"
                Else
                    If hp IsNot Nothing Then
                        b.filter = "{B_Goods}.Name = '" & hp & "' and {O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " '"
                    Else
                        If kh IsNot Nothing Then
                            b.filter = "{B_Client}.Name = '" & kh & "' and {O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " '"
                        Else
                            b.Filter = "{O_Sale1}.BillDate >= '" & A & "' And {O_Sale1}.BillDate <= '" & C & " ' "
                        End If
                    End If
                End If
            End If
        End If
    End If
End If
这个代码怎么优化
[此贴子已经被作者于2015/6/14 14:48:11编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/6/14 15:58:00 [只看该作者]


 回到顶部
帅哥哟,离线,有人找我吗?
qingwuzu
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:68 积分:590 威望:0 精华:0 注册:2015/3/28 19:58:00
  发帖心情 Post By:2015/6/14 16:31:00 [只看该作者]

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

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/6/14 17:00:00 [只看该作者]


 回到顶部