Foxtable(狐表)用户栏目专家坐堂 → [求助]从外部表中首拼音查询


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

主题:[求助]从外部表中首拼音查询

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/11/22 19:24:00 [显示全部帖子]

你的代码没有问题

Dim Ts As String() = {"产品","客户"}
Dim t As Table = Tables("窗口1_table1")
Dim dtp1 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim dtp2 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
Dim v1 As Date = dtp1.value
Dim v2 As Date = dtp2.value
Dim sql,st,Lm,py,sul As String
Dim Ls As new List(of Integer)
Dim dt As DataTable
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "SELECT * From {订单} where 日期 >= #" & v1 & "# And 日期 <= #" & v2 & "#"
dt = cmd.ExecuteReader( )
Dim sw As String = e.sender.text
st = "'%" & sw & "%'"
If sw > "" Then
    For Each Lm In Ts
        For Each dr As DataRow In dt.dataRows
            py = GetPy(dr(lm),True)
            If dr(Lm).Indexof(sw.ToUpper)> -1 OrElse py.Indexof(sw.ToUpper)> -1 Then
                If Ls.Contains(dr("_Identify")) = False Then
                    Ls.add(dr("_Identify"))
                End If
            End If
        Next
    Next
    If Ls.count > 0 Then
        For Each n As Integer In Ls
            sql+ = "," & n
        Next
        sql = "[_Identify] in (" & sql.trim(",") & ")"
        sul+ = "select 产品,客户,雇员,单价,数量,日期 from (Select * from {订单} where" & sql & ")"
        t.fill(sul,"yh",True)
        t.AutoSizeCols()
    Else If t.Rows.count > 0 Then
        With t
            For i As Integer = .Rows.count-1 To 0 Step -1
                .Rows(i).Delete()
            Next
        End With
    End If
End If
[此贴子已经被作者于2013-11-22 19:26:44编辑过]

 回到顶部