以文本方式查看主题 - 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=142846) |
-- 作者:江南小镇 -- 发布时间:2019/11/7 15:26:00 -- [求助]删除 老师好,删除出库.出库明细表行时做判断先删除第一列和第二列单元格的字段(是图片列) |
-- 作者:狐狸爸爸 -- 发布时间:2019/11/7 15:53:00 -- 可以利用这个事件进行判断删除: |
-- 作者:江南小镇 -- 发布时间:2019/11/7 16:16:00 -- 老师,这是删除关联表行的代码。 If Tables("出库.出库明细") .Rows.count = 0 Then MessageBox.Show("没有可删除!") Return End If If Tables("出库.出库明细") .Rows.count > 0 AndAlso Tables("出库.出库明细") .Current.Isnull("审核人") = False Then MessageBox.Show("已审核,请反审!") Return End If If Tables("出库.出库明细") .Current.Isnull("审核人") = True Then If MessageBox.Show("是否删除?","确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) =DialogResult.OK Then Tables("出库.出库明细") .Current.Delete End If End If
|
-- 作者:有点蓝 -- 发布时间:2019/11/7 16:29:00 -- 有什么问题? |
-- 作者:江南小镇 -- 发布时间:2019/11/7 17:56:00 -- 老师,我的意思是在删除行时如果第一列和第二列有数据时就提示不能删除行先删除第一列和第二列的值然后再删除行。 If Tables("出库.出库明细") .Rows.count = 0 Then MessageBox.Show("没有可删除!") Return End If If Tables("出库.出库明细") .Rows.count > 0 AndAlso Tables("出库.出库明细") .Current.Isnull("审核人") = False Then MessageBox.Show("已审核,请反审!") Return End If If Tables("出库.出库明细") .Current.Isnull("审核人") = True Then If MessageBox.Show("是否删除?","确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) =DialogResult.OK Then Tables("出库.出库明细") .Current.Delete End If End If |
-- 作者:狐狸爸爸 -- 发布时间:2019/11/7 19:57:00 -- 你的代码和你的问题有联系吗? 怎么提问都不会呢? 我回复这个问题:我的意思是在删除行时如果第一列和第二列有数据时就提示不能删除行先删除第一列和第二列的值然后再删除行。 如果你是自己做的删除按钮: Dim r As Row = Tables("表名").Current if r is Nothing Then return End if if r.Isnull("第一列") andalso r.Isnull("第二列") then r.Delete() else Messagebox.show("请先删除第一列和第二列的内容,才能删除行!") end If
|
-- 作者:江南小镇 -- 发布时间:2019/11/8 6:32:00 -- 老师,下面代码是删除关联表子表行的按钮代码,子表有两列是图片列,在删除该行时做个判断如果两列图片列的单元格有数据先清空后再删除整行。 If Tables("出库.出库明细") .Rows.count = 0 Then MessageBox.Show("没有可删除!") Return End If If Tables("出库.出库明细") .Rows.count > 0 AndAlso Tables("出库.出库明细") .Current.Isnull("审核人") = False Then MessageBox.Show("已审核,请反审!") Return End If If Tables("出库.出库明细") .Current.Isnull("审核人") = True Then If MessageBox.Show("是否删除?","确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) =DialogResult.OK Then Tables("出库.出库明细") .Current.Delete End If End If [此贴子已经被作者于2019/11/8 6:34:18编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/11/8 9:52:00 -- 有这个必要吗?整行都删除了,单元格数据自然也就没有了 |
-- 作者:江南小镇 -- 发布时间:2019/11/8 13:38:00 -- 老师好,两列是图片列我要把文件夹中的图片一同删除。 |
-- 作者:有点蓝 -- 发布时间:2019/11/8 14:19:00 -- 一开始就这样说不就好了,删除数据和删除文件完全是两回事 If Tables("出库.出库明细") .Current.Isnull("审核人") = True Then If MessageBox.Show("是否删除?","确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) =DialogResult.OK Then Dim lst As List(of String) Tables("出库.出库明细").Current.DataRow.Lines("图片") For Each s As String In lst msgbox(s) \'根据 FileSys.DeleteFile(ProjectPath & "Attachments\\" & s,2,2) Next Tables("出库.出库明细") .Current.Delete End If End If |