以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  代码报错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=113810)

--  作者:雅痞123456
--  发布时间:2018/1/23 15:41:00
--  代码报错

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

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

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


Dim cmb1 As WinForm.ComboBox = e.Form.Controls( "产品型号")
Dim cmb2 As WinForm.ComboBox = e.Form.Controls("工序号")
Dim cmb3 As WinForm.ComboBox = e.Form.Controls("领取人")
cmb1.ComboList = DataTables("工艺卡片发放记录").GetComboListString("产品型号")
cmb2.ComboList = DataTables("工艺卡片发放记录").GetComboListString("工序号")
cmb3.ComboList = DataTables("工艺卡片发放记录").GetComboListString("第一份_领取人")

如果想拾取三列   代码如何修改呢

--  作者:有点甜
--  发布时间:2018/1/23 15:44:00
--  

提示错误,说明你列名写错了。去看看正确的列名是什么

 

http://www.foxtable.com/webhelp/scr/0193.htm

 


--  作者:雅痞123456
--  发布时间:2018/1/23 16:45:00
--  
如果我想搜索第一份_领取人  第二份_领取人  第三份_领取人   这三列  代码应该怎么修改一下呢


--  作者:有点甜
--  发布时间:2018/1/23 17:07:00
--  

参考代码

 

Dim cs() As String = {"第一列", "第二列", "第三列"}
Dim ls As new List(of String)
For Each dr As DataRow In DataTables("表A").Select("")
    For Each c As String In cs
        If dr(c) <> Nothing AndAlso ls.Contains(dr(c)) = False Then
            ls.add(dr(c))
        End If
    Next
Next
Dim str As String = String.Join("|", ls.ToArray)
msgbox(str)


--  作者:雅痞123456
--  发布时间:2018/1/24 9:52:00
--  
Dim cs() As String = {"第一份_领取人", "第二份_领取人", "第三份_领取人"}
Dim ls As new List(of String)
For Each dr As DataRow In DataTables("工艺卡片发放记录").Select("")
    For Each c As String In cs
        If dr(c) <> Nothing AndAlso ls.Contains(dr(c)) = False Then
            ls.add(dr(c))
        End If
    Next
Next
Dim str As String = String.Join("|", ls.ToArray)
Dim cmb1 As WinForm.ComboBox = e.Form.Controls( "产品型号")
Dim cmb2 As WinForm.ComboBox = e.Form.Controls("工序号")
Dim cmb3 As WinForm.ComboBox = e.Form.Controls("第一份_领取人")
cmb1.ComboList = DataTables("工艺卡片发放记录").GetComboListString("产品型号")
cmb2.ComboList = DataTables("工艺卡片发放记录").GetComboListString("工序号")
cmb3 .ComboList = "str()"


试了一下参考代码  可以显示所有的姓名   但是我改就改不出来了  老师能否帮忙改正一下     还有学习FOXtable  两个月了现在看别人代码能看懂  但是要是写的话答题思路知道  但就是写完以后反反复复会出现错误  这是怎么回事呢   还望指教

--  作者:有点甜
--  发布时间:2018/1/24 9:55:00
--  
cmb3 .ComboList = str
--  作者:雅痞123456
--  发布时间:2018/1/24 14:11:00
--  

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

改完了以后也搜索不到   是不是搜索按钮的代码也需要改一下呢

Dim nms() As String = {"产品型号","第一份_领取人","工序号", "领取日期" ,"返回日期"}
Dim sps() As String = {"\'","\'","\'",",",",","#","#"}
Dim bjf() As String = {"=","=","=","=","=",">=","<="}
Dim fds() As String = {"产品型号","第一份_领取人","工序号","日期","日期"}
Dim Filter As String
For i As Integer = 0 To nms.Length - 1
    If e.Form.Controls(nms(i)).value IsNot Nothing Then
        If filter > "" Then
            filter = filter & " and "
        End If
        filter =filter & fds(i) & bjf(i) & sps(i) & e.Form.Controls(nms(i)).value & sps(i)
    End  If
Next
If e.Form.Controls( "已还").checked = True
    If filter > "" Then
        filter = filter & "and "
    End If
    If e.Form.Controls( "已还").checked = True
        If filter > "" Then
            filter = filter & " and "
        End If
        filter=filter & " 已还=true"
    End If
    If e.Form.Controls( "未还").checked = True
        If filter > "" Then
            filter = filter & " and "
        End If
        filter=filter & " (未还 =false or 未还 is null)"
    End If
End If
Tables("工艺卡片发放记录").filter = filter

--  作者:有点甜
--  发布时间:2018/1/24 14:13:00
--  
msgbox(filter) 弹出什么?
--  作者:有点甜
--  发布时间:2018/1/24 14:21:00
--  
Dim nms() As String = {"产品型号","工序号", "领取日期" ,"返回日期"}
Dim sps() As String = {"\'","\'","#","#"}
Dim bjf() As String = {"=","=","=","="}
Dim fds() As String = {"产品型号","工序号","日期","日期"}
Dim Filter As String
For i As Integer = 0 To nms.Length - 1
    If e.Form.Controls(nms(i)).value IsNot Nothing Then
        If filter > "" Then
            filter = filter & " and "
        End If
        filter =filter & fds(i) & bjf(i) & sps(i) & e.Form.Controls(nms(i)).value & sps(i)
    End  If
Next
With e.Form.Controls( "领取人")
    If .text
        If filter > "" Then
            filter = filter & " and "
        End If
        filter=filter & "(第一份_领取人 = \'" & .value & "\' or 第二份_领取人 = \'" & .value & "\')"
    End If
End With
If e.Form.Controls( "已还").checked = True
    If filter > "" Then
        filter = filter & " and "
    End If
    filter=filter & " 已还=true"
End If
If e.Form.Controls( "未还").checked = True
    If filter > "" Then
        filter = filter & " and "
    End If
    filter=filter & " (未还 =false or 未还 is null)"
End If
Tables("工艺卡片发放记录").filter = filter

--  作者:有点甜
--  发布时间:2018/1/24 14:22:00
--  
不会做就请上传实例。