Foxtable(狐表)用户栏目专家坐堂 → 错误提示,列为只读,搞不清楚问题出在哪


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

主题:错误提示,列为只读,搞不清楚问题出在哪

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


加好友 发短信
等级:四尾狐 帖子:858 积分:6381 威望:0 精华:0 注册:2017/2/13 9:04:00
错误提示,列为只读,搞不清楚问题出在哪  发帖心情 Post By:2018/3/16 16:30:00 [只看该作者]

Button5,Click事件:

 

Dim r As Row = Tables("报价单").Current
Dim dnew As Row = Tables("报价单").AddNew
Dim name As String = r("订单编号") & "*"
For Each c As Col In Tables("报价单").Cols
    If c.Name = "订单编号" Then
        dnew(c.Name) = name
    ElseIf c.Name <> "_Identify" Then
        dnew(c.Name) = r(c.Name)
    End If
Next
Tables("报价单").Current("财务审核") = Nothing
Tables("报价单").Current("总经理审批") = Nothing

 


Dim drs As List(Of DataRow)
drs = r.DataRow.GetChildRows("报价明细")
Dim rc As DataRow
For Each dr As DataRow In drs
    rc = dr.Clone
    rc("订单编号") = name
Next

 

运行弹出提示:

.NET Framework 版本:2.0.50727.8669
Foxtable 版本:2018.3.3.1
错误所在事件:窗口,报价记录,Button5,Click
详细错误信息:
列“研发管理费”为只读。

 

关键是列“研发管理费”没有设只读



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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2018/3/16 16:55:00 [只看该作者]

说明这一列是表达式列,表达式列不能用代码修改值,排除掉表达式列:

Dim r As Row = Tables("报价单").Current
Dim dnew As Row = Tables("报价单").AddNew
Dim name As String = r("订单编号") & "*"
For Each c As Col In Tables("报价单").Cols
    If c.DataCol.Expression = "" Then
        If c.Name = "订单编号" Then
            dnew(c.Name) = name
        ElseIf c.Name <> "_Identify" Then
            dnew(c.Name) = r(c.Name)
        End If
    End If
Next
Tables("报价单").Current("财务审核") = Nothing
Tables("报价单").Current("总经理审批") = Nothing

Dim drs As List(Of DataRow)
drs = r.DataRow.GetChildRows("报价明细")
Dim rc As DataRow
For Each dr As DataRow In drs
    rc = dr.Clone
    rc("订单编号") = name
Next


或者直接判断列名:


Dim r As Row = Tables("报价单").Current
Dim dnew As Row = Tables("报价单").AddNew
Dim name As String = r("订单编号") & "*"
For Each c As Col In Tables("报价单").Cols
    If c.Name <> "研发管理费" Then
        If c.Name = "订单编号" Then
            dnew(c.Name) = name
        ElseIf c.Name <> "_Identify" Then
            dnew(c.Name) = r(c.Name)
        End If
    End If
Next
Tables("报价单").Current("财务审核") = Nothing
Tables("报价单").Current("总经理审批") = Nothing

Dim drs As List(Of DataRow)
drs = r.DataRow.GetChildRows("报价明细")
Dim rc As DataRow
For Each dr As DataRow In drs
    rc = dr.Clone
    rc("订单编号") = name
Next
[此贴子已经被作者于2018/3/16 16:56:53编辑过]

 回到顶部