以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- 窗口,确认按钮这样写,报错 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=86470) |
||||
-- 作者:yancheng -- 发布时间:2016/6/17 21:29:00 -- 窗口,确认按钮这样写,报错 Dim r As Row = Tables("采购入库").Current If r Is Nothing Then Return End If For Each c As Col In Tables("采购入库").Cols Sele ct Ca se c.Name Case "合同名称","合同编号","入库日期","供应商","供应商编号","入库批次" If r.IsNull(c.Name) Then MessageBox.Show("粉红框部分不可以为空!", "警告!", MessageBoxButtons.Ok, MessageBoxIcon.Warning) Return Else Tables("采购入库").Current.Save() If Forms("采购入库").Opened=True Then Dim cmd As New SQLCom mand Dim dt As DataTable cmd.C cmd.CommandText = "Sele ct Distinct Year(入库日期) As 年, Month(入库日期) As 月,合同名称,供应商 From {采购入库}" dt = cmd.ExecuteReader() Dim tv As WinForm.TreeView = Forms("采购入库").Controls("TreeView1") tv.StopRedraw tv.Nodes.Clear tv.BuildTree(dt,"合同名称|年|月|供应商","","合同名称 desc,年,月,月") tv.Nodes.Insert("所有订单",0) tv.ResumeRedraw tv.Nodes(1).Expand() End If End If End Sel ect Next e.Form.Close [此贴子已经被作者于2016/6/19 18:01:12编辑过]
|
||||
-- 作者:狐狸爸爸 -- 发布时间:2016/6/18 8:39:00 -- 上面的代码代码不应该出这个错误,你做个例子发上来看看。
写代码要用e参数,例如要引用触发事件的行,应该是e.Datarow或e.Row,不要用Current |
||||
-- 作者:Hyphen -- 发布时间:2016/6/18 8:42:00 -- 数据库表有不能为空的字段保存了空值 |
||||
-- 作者:yancheng -- 发布时间:2016/6/19 18:00:00 -- 我把代码改成这样,就可以了。
[此贴子已经被作者于2016/6/19 18:00:07编辑过]
|
||||
-- 作者:yancheng -- 发布时间:2016/6/19 18:01:00 -- 改成这样就可以了。 改成这样就可以了。 |
||||
-- 作者:yancheng -- 发布时间:2016/7/17 22:18:00 -- 错误依照,我都晕了。 Dim r As Row = Tables("材料").Current If r Is Nothing Then Return Else For Each c As Col In Tables("材料").Cols Sele ct Case c.Name Case "材料名称","定额编码","分类","子分类","成本价","单位" If r.IsNull(c.Name) Then MessageBox.Show("红字部分不可以为空!", "警告!", MessageBoxButtons.Ok, MessageBoxIcon.Warning) Return End If End Se lect Next End If Tables("材料").Save() If Forms("材料").Opened= True Then Dim cmd As New SQ LCom mand Dim dt As DataTable cmd.Conne cti cmd.Comm andText = "SELE CT DIS TINCT 分类,子分类 From {材料}" dt = cmd.Exe cuteReader() If dt.DataRows.Count > 0 Then Dim tv As WinForm.TreeView tv =Forms("材料").Controls("TreeView1") tv.StopRedraw tv.Nodes.Clear tv.BuildTree(dt,"分类|子分类","","分类") tv.Nodes.Insert("所有商品",0) tv.ResumeRedraw tv.ExpandAll End If End If
|
||||
-- 作者:Hyphen -- 发布时间:2016/7/18 9:00:00 -- Tables("材料").Current.DataRow.Save |
||||
-- 作者:yancheng -- 发布时间:2016/7/18 13:50:00 -- 还是不行,同样的问题。 |
||||
-- 作者:Hyphen -- 发布时间:2016/7/18 14:32:00 -- 上例子 |
||||
-- 作者:yancheng -- 发布时间:2016/7/18 16:17:00 --
|