以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  给定关键字不在字典中  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=169923)

--  作者:seal51
--  发布时间:2021/7/6 11:15:00
--  给定关键字不在字典中
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2021.5.29.1
错误所在事件:项目,AfterOpenProject
详细错误信息:
给定关键字不在字典中。

AfterOpenProject代码如下:


Forms("Main").open
Applicati
For Each t As Table In Tables
    t.Font=New Font("宋体",11,FontStyle.Regular)
Next
\'------------------------------------------------------------------------------
If GetConfigValue("注册状态" & ComputerId,False) = False Then  \'若是非注册状态
    Forms("注册窗口").open
End If
\'------------------------------------------------------------------------------


Dim drs As New List(of DataRow)
With DataTables("库存明细表")
    For Each nm As String In .GetValues("产品ID", "产品ID is not null") \'找出每个产品的第一行数据, 添加到集合drs中
        drs.Add(.Find("产品ID = \'" & nm & "\'", "[_SortKey]"))
    Next
    For Each r As DataRow In drs
        .DataCols("入库数量").RaiseDataColChanged(r) \'重置每个产品的第一行
    Next
End With


\'授权
If user.Type = UserTypeEnum.User Then
    Tables("授权表").Visible = False
End If
For Each dr As DataRow In DataTables("授权表").Select("用户名 = \'" & user.name & "\'")
    If dr.Isnull ("列名") Then
        Tables(dr("表名")).Visible = Not dr("不可见")
        Tables(dr("表名")).AllowEdit = Not dr("不可编辑")
    Else
        Tables(dr("表名")).Cols(dr("列名")).Visible = Not dr("不可见")
        Tables(dr("表名")).Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
    End If
Next

--  作者:有点蓝
--  发布时间:2021/7/6 11:24:00
--  
调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm,看哪一句代码出错

dim dr1 as datarow
    For Each nm As String In .GetValues("产品ID", "产品ID is not null") \'找出每个产品的第一行数据, 添加到集合drs中
dr1 = .Find("产品ID = \'" & nm & "\'", "[_SortKey]")
if dr1 isnot nothing
        drs.Add(dr1)
end if
    Next

--  作者:seal51
--  发布时间:2021/7/6 11:58:00
--  
4台电脑,其他3台安装WIN10没有此提示,只有一台电脑安装WIN7的有这个提示
--  作者:有点蓝
--  发布时间:2021/7/6 13:31:00
--  
老是纠结那台电脑没有问题,之前没有问题,运行 10年没有问题,没有任何意义。有问题就查错

调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm,看哪一句代码出错

--  作者:seal51
--  发布时间:2021/7/7 9:43:00
--  
小白,不太会
是在命令窗口
For Each t As Table In Tables
    t.Font=New Font("宋体",11,FontStyle.Regular)
Next
MessageBox.Show()
然后执行,看跳出的对话框吗?

--  作者:有点蓝
--  发布时间:2021/7/7 9:53:00
--  
等级都七尾狐了,发帖1735,基本的调试用法都还不会用?!

在1楼代码每一行后面加上调试代码,看执行到哪一个提示框后出错

Forms("Main").open
msgbox(1)
Applicati
For Each t As Table In Tables
    t.Font=New Font("宋体",11,FontStyle.Regular)
Next
msgbox(2)
\'------------------------------------------------------------------------------
If GetConfigValue("注册状态" & ComputerId,False) = False Then  \'若是非注册状态
    Forms("注册窗口").open
End If
msgbox(3)
\'------------------------------------------------------------------------------


Dim drs As New List(of DataRow)
With DataTables("库存明细表")
msgbox(4)
……

--  作者:seal51
--  发布时间:2021/7/7 9:59:00
--  
Forms("Main").open
msgbox(1)
Applicati
For Each t As Table In Tables
    t.Font=New Font("宋体",11,FontStyle.Regular)
Next
msgbox(2)

\'------------------------------------------------------------------------------
If GetConfigValue("注册状态" & ComputerId,False) = False Then  \'若是非注册状态
    Forms("注册窗口").open
End If
msgbox(3)
\'------------------------------------------------------------------------------

Dim drs As New List(of DataRow)
With DataTables("库存明细表")
    For Each nm As String In .GetValues("产品ID", "产品ID is not null") \'找出每个产品的第一行数据, 添加到集合drs中
        drs.Add(.Find("产品ID = \'" & nm & "\'", "[_SortKey]"))
    Next
    For Each r As DataRow In drs
        .DataCols("入库数量").RaiseDataColChanged(r) \'重置每个产品的第一行
    Next
End With
msgbox(4)
DataTables("图纸进度表").DataCols("下图日期").RaiseDataColChanged()
msgbox(5)
DataTables("图纸进度表").DataCols("设计完成日期").RaiseDataColChanged()
msgbox(6)
DataTables("图纸进度表").DataCols("确认期1").RaiseDataColChanged()
msgbox(7)


If user.Type = UserTypeEnum.User Then
    Tables("授权表").Visible = False
End If
For Each dr As DataRow In DataTables("授权表").Select("用户名 = \'" & user.name & "\'")
    If dr.Isnull ("列名") Then
        Tables(dr("表名")).Visible = Not dr("不可见")
        Tables(dr("表名")).AllowEdit = Not dr("不可编辑")
    Else
        Tables(dr("表名")).Cols(dr("列名")).Visible = Not dr("不可见")
        Tables(dr("表名")).Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
    End If
Next
msgbox(8)

复制到命令窗口,点击执行,返回的都是数字1,2,3,4,5,6,7,8

--  作者:有点蓝
--  发布时间:2021/7/7 10:03:00
--  
AfterOpenProject事件里调试
--  作者:seal51
--  发布时间:2021/7/7 10:05:00
--  
复制到AfterOpenProject事件里,点击确定,返回的都是数字1,2,3,4,5,6,7,8
--  作者:有点蓝
--  发布时间:2021/7/7 10:16:00
--  
中间没有提示没有出错?