Rss & SiteMap

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

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

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

1楼
edwells 发表于:2011/8/24 0:10:00
如果做人事管理系统,几百人的话,需要模糊查询,像极品列车时刻表那样, 例如:输入zx,就能在下拉列表里显示库里的所有相关人名:“张笑,张小、章萧……”等等
2楼
hhbb 发表于: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
3楼
169163 发表于:2011/8/24 9:49:00
请hhbb老师传个例子好吗?
4楼
c 发表于:2011/8/24 10:02:00

Dim a As String ="张笑,张小,章萧,喜爱"
Dim sz As new List(of String)
For Each g As String In a.Split(",") '添加进 集合 sz
    If sz.Contains(g)=False Then  '判断有无重复
        sz.Add(g)
    End If
Next

Dim zm As String = "zx" '定义要查找的 拼音 首字母
For Each g As String In sz
    If getpy(g,True) = zm Then
        output.show(g)
    End If
Next
       

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

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

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