有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。
************** 异常文本 **************
System.ArgumentException: 列“sys_Hierarchy_Level”不属于表 BOM查看_Table1。
在 System.Data.DataRow.GetDataColumn(String columnName)
在 System.Data.DataRow.IsNull(String columnName)
在 Foxtable.Row.get_Item(String ColumnName)
在 Foxtable.Row.get_HasChild()
在 Foxtable.OO__O_o_oO00_.O.__OO_o__oO0.(Object A_0, OwnerDrawCellEventArgs A_1, Boolean A_2, Boolean A_3, Boolean& A_4)
在 Foxtable.OO__O_o_oO00_.oOo0ooOo.0_.(Object A_0, OwnerDrawCellEventArgs A_1)
在 C1.Win.C1FlexGrid.C1FlexGridBase.OnOwnerDrawCell(OwnerDrawCellEventArgs e)
在 C1.Win.C1FlexGrid.C1FlexGridBase.#gdb(OwnerDrawCellEventArgs #tQ)
在 C1.Win.C1FlexGrid.C1FlexGridBase.#fdb(Graphics #AA, Int32 #j, Int32 #l, Style #aE, Rectangle #o5, String #gM, String #yxd, Int32 #xEu, Image #Ak, Sparkline #fmh)
在 C1.Win.C1FlexGrid.C1FlexGridBase.DrawCell(Graphics #AA, Int32 #j, Int32 #l, Style #aE, Rectangle #o5, String #gM, String #yxd, Int32 #xEu, Image #Ak, CheckEnum #bdb, Sparkline #fmh)
在 C1.Win.C1FlexGrid.C1FlexGridBase.DrawCell(PaintEventArgs e, Int32 row, Int32 col)
在 C1.Win.C1FlexGrid.C1FlexGrid.DrawCell(PaintEventArgs e, Int32 row, Int32 col)
在 C1.Win.C1FlexGrid.C1FlexGrid.DrawRow(PaintEventArgs e, Int32 row)
在 C1.Win.C1FlexGrid.C1FlexGridBase.#adb(PaintEventArgs #tQ)
在 C1.Win.C1FlexGrid.C1FlexGridBase.OnPaint(PaintEventArgs e)
在 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
在 System.Windows.Forms.Control.WmPaint(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
如以下代码加载进来的数据BOM文件。第一次加载是没有问题的。加载完成后,如果再点击加载就会出现以上蓝色字体的错误
MessageBox.Show(3)可以正常显示,之后就会出现上面的提示错误,点击继续后才可以出现MessageBox.Show(2)
Dim Wlid As Integer = e.Form.Controls("TextWlid").text
Dim cmd As New SQLCommand
cmd.C
Dim tb As Table = Tables(e.Form.Name & "_Table1")
Dim dt As DataTable = tb.DataTable
'If dt.DataRows.Count > 0 Then dt.DataRows.Clear
MessageBox.Show(3)
cmd.CommandText = "se lect * from {BOMMX} where [fjid] = " & wlid
tb.DataSource = cmd.ExecuteReader
MessageBox.Show(2)
If dt.DataCols.Contains("Zsn") = False Then dt.DataCols.Add("Zsn", GetType(String), 255)
If dt.DataCols.Contains("总序号") = False Then dt.DataCols.Add("总序号", GetType(String), 255)
If dt.DataCols.Contains("投产量") = False Then dt.DataCols.Add("投产量", GetType(Single))
For Each dr As DataRow In dt.DataRows
dr("zsn") = Format(dr("序号"), "000")
dr("总序号") = dr("序号")
dr("投产量") = dr("用量")
cmd.CommandText = "sele ct * from {BOMMX} where [fjid] = " & dr("wlid")
' MessageBox.Show(cmd.CommandText)
Dim vdt As DataTable = cmd.ExecuteReader
If vdt.DataRows.Count > 0 Then
Functions.Execute("BOM_Expand", dt, dr("wlid"), dr("zsn"), dr("总序号"), dr("用量") )
End If
Next
tb.SetColVisibleWidth("总序号|120|序号|36|料号|153|旧料号|153|名称|144|规格|189|单位|49|用量|70|投产量|70|Note|246")
dt.dataCols("Note").Caption = "备注"
dt.BuildHeader
dt.DataCols.Add("sl", GetType(Integer), "[Itid] / [Itid]")
tb.Sort = "zsn"
Exit Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim trv As WinForm.LayersTree = e.Form.Controls("LayersTree1")
Dim st As New LayerTreeSetting
st.PathCol = "总序号"
st.TextCol = "名称"
st.ValueCol = "sl"
st.Separator = "."
'st.SortCol = "Zsn"
st.GridTree = True
st.Subtotal = True
st.UseStyle = True
st.GridTree = True
st.ExpandTo = -1
trv.BuildBomTree(Tb, st)
tb.ShowGridTree(st)
"BOM_Expand" 内部函数代码如下。
Dim cmd As new SQLCommand
cmd.C
Dim dt As DataTable = args(0)
cmd.CommandText = "sel ect * from {BOMMX} where [fjid] = " & args(1)
Dim vdt As DataTable = cmd.ExecuteReader
If vdt.DataRows.Count > 0 Then
For Each vdr As DataRow In vdt.DataRows
Dim nr As DataRow = dt.AddNew
For Each dc As DataCol In vdt.DataCols
nr(dc.Name) = vdr(dc.Name)
Next
nr("zsn") = args(2) & "." & Format(vdr("序号"),"000")
nr("总序号") = args(3) & "." & vdr("序号")
nr("投产量") = args(4) * nr("用量")
Functions.Execute("BOM_Expand",dt,nr("wlid"),nr("zsn"),nr("总序号"),nr("投产量"))
Next
End If