Foxtable(狐表)用户栏目专家坐堂 → 怎么无法删除数据库的相关行,帮我看看是不是哪里出错了


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

主题:怎么无法删除数据库的相关行,帮我看看是不是哪里出错了

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


加好友 发短信
等级:一尾狐 帖子:437 积分:2949 威望:0 精华:0 注册:2011/3/15 12:49:00
怎么无法删除数据库的相关行,帮我看看是不是哪里出错了  发帖心情 Post By:2019/12/30 16:18:00 [只看该作者]

        Dim rr As Row = Tables("订单查询_订单表").Current
        Dim filter As String = "合同号 = '" & rr("合同号") & "' And 款号 = '" & rr("款号") & "'"
        Dim filters As String = "合同号 = '" & rr("合同号") & "'And 款号 = '" &  rr("款号") & "' And 业务担当 = '" & rr("业务担当") & "' And 合同交期 = '" & rr("合同交期") & "' And 客户名称 = '" & rr("客户名称") & "' And 品名 = '" & rr("品名") & "' And 合同数量 = '" & rr("合同数量") & "' "
        
        Dim cmd As New SQLCommand
        Dim ds0 As DataTable
        Dim ds1 As DataTable
        Dim ds2 As DataTable
        Dim ds3 As DataTable
        Dim ds4 As DataTable
        Dim ds5 As DataTable
        Dim cmb As WinForm.ComboBox
        cmd.C
        cmd.CommandText = "SELEC1T * From {订单主表}"
        ds0 = cmd.ExecuteReader()
        cmd.CommandText = "SELEC1T * From {订单数量明细}"
        ds1= cmd.ExecuteReader()
        cmd.CommandText = "SELEC1T * From {配色表}"
        ds2 = cmd.ExecuteReader()
        cmd.CommandText = "SELEC1T * From {订单辅料明细}"
        ds3= cmd.ExecuteReader()
        cmd.CommandText = "SELEC1T * From {订单面料明细}"
        ds4 = cmd.ExecuteReader()
        cmd.CommandText = "SELEC1T * From {面料委托表}"
        ds5 = cmd.ExecuteReader()
        Dim drZ As  List(Of DataRow) = ds0.Selec1t(filters)
        Dim drs As  List(Of DataRow) = ds1.Selec1t(filter)
        Dim drp As  List(Of DataRow) = ds2.Selec1t(filter)
        Dim drf As  List(Of DataRow) = ds3.Selec1t(filter)
        Dim drm As  List(Of DataRow) = ds4.Selec1t(filter)
        Dim dtm As  List(Of DataRow) = ds5.Selec1t(filter)
        For Each dr As DataRow In drp
            dr.Delete()
        Next
        For Each dr As DataRow In drs
            dr.Delete()
            ds1.Save()
        Next
        For Each dr As DataRow In drf
            dr.Delete()
            ds2.Save()
        Next
        For Each dr As DataRow In drm
            dr.Delete()
            ds3.Save()
        Next
        For Each dr As DataRow In drZ
            dr.Delete()
            ds4.Save()
        Next
        For Each dr As DataRow In dtm
            dr.Delete()
            ds5.Save()
        Next


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


加好友 发短信
等级:超级版主 帖子:110647 积分:563143 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/30 16:29:00 [只看该作者]

Dim cmd As New SQLCommand
cmd.ConnectionName = ""
cmd.CommandText = "delete From {订单主表} where " & filters
cmd.ExecuteNonQuery

cmd.CommandText = "delete From {订单数量明细} where " & filters
cmd.ExecuteNonQuery

……

 回到顶部