Foxtable(狐表)用户栏目专家坐堂 → [求助]拼音首字查询,模糊查询


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

主题:[求助]拼音首字查询,模糊查询

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


加好友 发短信
等级:等待验证 帖子:386 积分:2482 威望:0 精华:1 注册:2011/5/10 11:13:00
  发帖心情 Post By:2011/8/24 9:21:00 [显示全部帖子]

模糊匹配:编号,姓名,部门,职务,简拼也行

范例文件:传统编辑模式
1.建一窗口1
2.插入:ComboBox1,Table1
3.ComboBox1的TextChanged事件代码:


Dim Ts As String() = {"编号","姓名","部门","职务"}
Dim t As Table =Tables("窗口1_Table1")
Dim st,ls ,py,Lm,str,Lss As String
st = e.sender.Text.ToUpper

If st IsNot Nothing Then
    For Each Lm In Ts
        For Each dr As DataRow In DataTables("员工").DataRows            
            py = GetPY(dr(Lm),True)
            If dr(Lm).IndexOf(st)> -1 OrElse py.IndexOf(st) > -1 Then
                If Ls Is Nothing Then
                    Ls = dr("_Identify")
                Else
                    If Ls.IndexOf(dr("_Identify")) = -1 Then
                        ls+= "," &  dr("_Identify")
                    End If
                End If
                
                If Lss Is Nothing Then
                    Lss = dr(Lm)
                Else
                    If Lss.IndexOf(dr(Lm)) = -1 Then
                        Lss+ = "|" & dr(Lm)
                    End If
                End If
            End If
        Next
    Next
    If ls IsNot Nothing Then
        Ls ="[_Identify] In(" & Ls & ")"
        Ls="select 编号,姓名 ,部门,职务 from{员工} where " & Ls
        t.Fill(Ls,True)
        e.sender.ComboList = Lss
    End If
End If

 回到顶部