Foxtable(狐表)用户栏目专家坐堂 → 帮我看看哪里错了?


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

主题:帮我看看哪里错了?

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


加好友 发短信
等级:一尾狐 帖子:437 积分:2949 威望:0 精华:0 注册:2011/3/15 12:49:00
帮我看看哪里错了?  发帖心情 Post By:2020/3/11 0:56:00 [只看该作者]

Dim cls() As String = {"样衣款号","类别","项目名称","规格","成份或质地","克重","门幅","单位","单耗","单价","金额","供应商"} '定义列名
Dim lxs() As String = {"String","String","String","String","String","Short","String","String","Double","Double","Double","String"} '定义Type类型
Dim cds() As String = {"55","55","55","55","55","","16","16","","","","50"}
Dim dtb As New DataTableBuilder("临时核价表")
For i As Integer = 0 To  cls.Length - 1
    dtb.AddDef(cls(i),Gettype(lxs(i)),cds(i))
Next

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

请问这个该怎么写?


 回到顶部
帅哥哟,离线,有人找我吗?
程兴刚
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:7258 积分:40773 威望:0 精华:16 注册:2008/8/31 23:23:00
  发帖心情 Post By:2020/3/11 1:18:00 [只看该作者]

您定义的是字符型数组,怎么可能用来设置列类型?

参考这个对不同列类型的处理方法!

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110738 积分:563610 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/3/11 8:49:00 [只看该作者]

Gettype里面需要的是类型,而不是字符串,不能带双引号的。这里无法使用变量或者字符串替代,只能这样处理

if lxs(i) = "String" then
    dtb.AddDef(cls(i),Gettype(String),cds(i))
elseif lxs(i) = "Double" then
    dtb.AddDef(cls(i),Gettype(Double),cds(i))
elseif ......

 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2949 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2020/3/11 11:52:00 [只看该作者]

Dim ks As WinForm.Label = e.Form.Controls("款号")
Dim yk As WinForm.Label = e.Form.Controls("样衣款号")
Dim lb As WinForm.Label = e.Form.Controls("类别")
Dim jh As WinForm.Label = e.Form.Controls("计划交期")
Dim bj As WinForm.TextBox = e.Form.Controls("报价金额")
Dim zz As WinForm.TextBox = e.Form.Controls("最终价格")
Dim gps() As  String  = {"面料","辅料","二次加工"} '定义分组名称
Dim te() As String = {"客户","客户担当","类别","品名","款号","样衣款号","报价数量","计划交期","原料费用","辅料费用","二次加工费用","工缴费用","其他费用","管理费用","核价金额","技术担当"}
Dim cls() As String = {"款号","样衣款号","项目名称","规格","成份或质地","克重","门幅","单位","单耗","单价","金额","供应商","分类"} '定义列名
Dim lxs() As Object = {"String","String","String","String","String","Short","String","String","Double","Double","Double","String","String"} '定义Type类型
Dim cds() As String = {"55","55","55","55","55","","16","16","","","","50","40"}
Dim wdh() As String = {140,140,140,135,90,45,45,45,58,65,67,88,85}
Dim dtb As New DataTableBuilder("临时核价表")
For i As Integer = 0 To cls.Length - 1
    If lxs(i) = "String" Then
        dtb.AddDef(cls(i),Gettype(String),cds(i))
    ElseIf lxs(i) = "Double" Then
        dtb.AddDef(cls(i),Gettype(Double),cds(i))
    ElseIf lxs(i) = "Short" Then
        dtb.AddDef(cls(i),Gettype(Short),cds(i))
    End If
Next
dtb.Build()
For i As Integer = 0 To cls.Length - 1
    Tables("临时核价表").Cols(cls(i)).Width  = wdh(i)
Next
For i As Integer = 0 To gps.Length - 1
    Dim dt As DataTable = DataTables(gps(i) &"核价")
    msgbox(dt.name)
    Dim drs = dt.Select("款号 = '" & ks.Text & "'and 样衣号 like '%" & yk.Text & "%'","_sortkey")
    msgbox(drs.count)
    For Each dr As DataRow In drs
        Dim r As  DataRow = DataTables("临时核价表").AddNew()
        r("款号") = ks.Text
        r("样衣款号") = yk.Text
        r("项目名称") = dr(gps(i) & "名称")
        r("分类") = dt.name
    Next
Next
MainTable = Tables("临时核价表")

这个为什么没有被筛选出来呢?哪里错了?

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110738 积分:563610 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/3/11 12:18:00 [只看该作者]

说明没有符合条件的数据,或者符合条件的数据没有加载

For i As Integer = 0 To gps.Length - 1
    Dim dt As DataTable = DataTables(gps(i) &"核价")
    msgbox(dt.name)
    msgbox("款号 = '" & ks.Text & "' and 样衣号 like '%" & yk.Text & "%'") '这个条件拿到数据库里查询
    Dim drs = dt.Select("款号 = '" & ks.Text & "'and 样衣号 like '%" & yk.Text & "%'","_sortkey")
    msgbox(drs.count)


 回到顶部
帅哥哟,离线,有人找我吗?
hongye
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:2949 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2020/3/11 12:19:00 [只看该作者]

刚刚漏了窗口名,因为表是窗口里的,但是又出来新问题了

图片点击可在新窗口打开查看此主题相关图片如下:01.jpg
图片点击可在新窗口打开查看
这啥意思?


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110738 积分:563610 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/3/11 13:33:00 [只看该作者]

For i As Integer = 0 To cls.Length - 1
    If lxs(i) = "String" Then
        dtb.AddDef(cls(i),Gettype(String),cds(i))
    ElseIf lxs(i) = "Double" Then
        dtb.AddDef(cls(i),Gettype(Double))
    ElseIf lxs(i) = "Short" Then
        dtb.AddDef(cls(i),Gettype(Short))
    End If
Next

 回到顶部