以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  SQL 的SQLTable样式问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=176857)

--  作者:hongye
--  发布时间:2022/4/28 19:27:00
--  SQL 的SQLTable样式问题

DrawCell

\'Dim tb As WinForm.Table = e.For m.Controls("Table1")
\'Dim cmd As New SQLCommand
\'Dim dt As DataTable
\'cmd.C
\'cmd.CommandText = "SELECT * Fro m {面料订单明细}"
\'dt = cmd.ExecuteReader()
\'Dim d As Date = Date.Today
\'Dim d1 As Date = d.AddDays( - 15)
\'Dim dr As DataRow
\'dr = dt.SQLFind("交货日期 <= \'" & d1 & "\'") 
\'If dr IsNot Nothing Then
\'    e.Style = "a"
\'End If

怎么回事,这个代码会卡死,请问怎么改

AfterLoad

Dim tb As WinForm.Table = e.Form.Controls("Table1")
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "SELECT * Fr om {面料订单明细}"
dt = cmd.ExecuteReader(True)
tb.Table.DataSource = dt
tb.Table.SetColVisibleWidth("客户编号|60|面料名称|120|色号|45|颜色|50|面料门幅|60|面料克重|60|品牌|90|款号|60|件数|50|数量|50|交货日期|90|交货单位|100|备注|148")
tb.Table.Sort = "面料识别号,交货日期"
tb.Table.Grid.Cols(0).Width = 35
dt.AddUserStyle("a", Color.Red, Color.White)
[此贴子已经被作者于2022/4/28 20:26:35编辑过]

--  作者:有点蓝
--  发布时间:2022/4/28 20:38:00
--  
设置个样式而已,不要这么麻烦吧

DrawCell
if e.row("交货日期") <= Date.Today.AddDays( - 15) then
 e.Style = "a"
end if


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看


--  作者:hongye
--  发布时间:2022/4/28 21:26:00
--  
请问,如何在ComboBox里显示同一行的两列数据
比如说在ComboBox 筛选框里 显示“表A"的”第二列“和”第三列“的数据,显示格式为 :001 SS,(001是第二列的数据,SS是第三列的数据)

还有请问怎么做这样的筛选?
[此贴子已经被作者于2022/4/28 21:41:37编辑过]

--  作者:有点蓝
--  发布时间:2022/4/28 22:18:00
--  
1、比如
Dim cmb As WinForm.ComboBox
cmb = Forms(
"窗口1").Controls("ComboBox1")
cmb.ComboList = 
DataTables("订单").sqlGetComboListString("第二列+\' \' +第三列")

2、比如
dim srr() as stirng = Forms("窗口1").Controls("ComboBox1").text.split(" ")
dim filter as string = "第二列=\'" & srr(0) & "\' and 第三列=\'" & srr(1) & "\'"
msgbox(filter )

--  作者:hongye
--  发布时间:2022/4/28 23:44:00
--  

SelectedIndexChanged

Dim Filter As String

With e.Form.Controls("ComboBox1")

    If .Value IsNot Nothing Then

        Dim srr() As String = e.Form.Controls("ComboBox1").text.split(" ")

        Filter = "客户编号=\'" & srr(0) & "\' And 面料名称=\'" & srr(1) & "\'"

    End If

End With

With e.Form.Controls("ComboBox2")

    If .Value IsNot Nothing Then

        If Filter > "" Then

            Filter = Filter & " And "

        End If 

        Filter = Filter & "色号 = \'" & .Value & "\'"

    End If

End With

Tables("窗口3_Table1").Filter = filter


Enter

Dim kh As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim kh2 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim Filter As String
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        Dim srr() As String = e.Form.Controls("ComboBox1").text.split(" ")
        Filter = "客户编号=\'" & srr(0) & "\' and 面料名称=\'" & srr(1) & "\'"
    End If
End With
With e.Form.Controls("ComboBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "色号 = \'" & .Value & "\'"
    End If
End With
kh.ComboList = DataTables("窗口3_Table1").GetComboListString("色号", Filter)

不能这么写吗?还是哪里错了?
[此贴子已经被作者于2022/4/29 0:04:34编辑过]

--  作者:有点蓝
--  发布时间:2022/4/29 8:40:00
--  
调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm,看哪一句代码出错
--  作者:hongye
--  发布时间:2022/4/30 10:55:00
--  
Dim kh As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim kh2 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim kh3 As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim kh4 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim kh5 As WinForm.ComboBox = e.Form.Controls("ComboBox5")
Dim Filter As String
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If       
        Dim srr() As String = e.Form.Controls("ComboBox1").Text.split("-")
        Filter = "客户编号 = \'" & srr(0) & "\'and 面料名称 = \'" & srr(1) & "\'"
    End If 
End With
With e.Form.Controls("ComboBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Dim syr1() As String = e.Form.Controls("ComboBox2").Text.split("-")
        Filter = "色号 = \'" & syr1(0) & "\'and 颜色 = \'" & syr1(1) & "\'"
    End If 
End With
With e.Form.Controls("ComboBox4")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "款号 = \'" & .Value & "\'"
    End If 
End With
With e.Form.Controls("ComboBox5")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "交货单位 = \'" & .Value & "\'"
    End If 
End With
With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "交货日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "交货日期 <= #" & .Value & "#"
    End If
End With
kh3.ComboList = DataTables("窗口3_Table1").sqlGetComboListString("品牌", Filter )


不知道哪里错了,项目列表显示有问题,没有在前项目里的还会显示

--  作者:狐狸爸爸
--  发布时间:2022/5/1 7:47:00
--  
Dim kh As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim kh2 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim kh3 As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim kh4 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim kh5 As WinForm.ComboBox = e.Form.Controls("ComboBox5")
Dim Filter As String
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Dim srr() As String = e.Form.Controls("ComboBox1").Text.split("-")
        Filter = "客户编号 = \'" & srr(0) & "\'and 面料名称 = \'" & srr(1) & "\'"
    End If 
End With
With e.Form.Controls("ComboBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Dim syr1() As String = e.Form.Controls("ComboBox2").Text.split("-")
        Filter = Filter & "色号 = \'" & syr1(0) & "\'and 颜色 = \'" & syr1(1) & "\'"
    End If 
End With
With e.Form.Controls("ComboBox4")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "款号 = \'" & .Value & "\'"
    End If 
End With
With e.Form.Controls("ComboBox5")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "交货单位 = \'" & .Value & "\'"
    End If 
End With
With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "交货日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "交货日期 <= #" & .Value & "#"
    End If
End With
kh3.ComboList = DataTables("窗口3_Table1").sqlGetComboListString("品牌", Filter )