Foxtable(狐表)用户栏目专家坐堂 → 2022.01.29和最新预览版sql command bug


  共有3938人关注过本帖平板打印复制链接

主题:2022.01.29和最新预览版sql command bug

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


加好友 发短信
等级:小狐 帖子:302 积分:2069 威望:0 精华:0 注册:2017/11/19 9:46:00
2022.01.29和最新预览版sql command bug  发帖心情 Post By:2022/5/19 15:17:00 [只看该作者]

bug 描述:
通过sql command生成的datatable不能保存。sql server数据源。
这个错误简直没有道理。

代码示例:

Dim TotParts As Integer = 3
Dim SalesONX As String = "SO-009622"

If TotParts < 1 Then
    messagebox.show("Can not proceed. Total parts must >= 1" , "Error", Messageboxbuttons.ok, MessageBoxIcon.warning)
    Return 0
End If

Dim cmd As New SQLCo mmand
cmd.connectionname = _ConnectionName

cmd.Comma ndText = "SEL ECT * from {SalesOrdsForDispatch} where SalesON='" & SalesONX & "'"

Dim DTB As DataTable = cmd.Execu teReader(True)

Dim ExistTotParts As Integer = DTB.DataRows.count


If TotParts = ExistTotParts Then
    messagebox.show("Can not proceed. Total parts = existing no. of parts" , "Error", Messageboxbuttons.ok, MessageBoxIcon.warning)
    Return 0
End If
' ******************************************************************
If TotParts > ExistTotParts Then
    '如果全部发货了,则不允许再次拆分
    Dim tr As DataRow = dtb.find("DateDelivered is null")
    If tr Is Nothing Then
        messagebox.show("Can not proceed. All the parts have been delivered." , "Error", Messageboxbuttons.ok, MessageBoxIcon.warning)
        Return 0
    End If
     
    
    '增加新的parts
    Dim kr As DataRow = DTB.DataRows(0)
    For i As Integer = ExistTotParts + 1 To TotParts
        Dim nr As DataRow = DTB.addnew
        
        For Each cl As DataCol In DTB.DataCols
            Dim cname As String = cl.name
            If Cname Like "SiteFeed*" = False Then
                Select Case Cname
                    Case "Weight", "Status", "PartNo", "DateDelivered", "DispatchNo", "MaxLth", "Progress_Stock", "Printed"
                        
                    Case Else
                        nr(Cname) = kr(Cname)
                        
                End Select
                
            End If
        Next
        
        nr("PartNo") = i & "/" & TotParts
        
    Next
 
    Output.Show(dtb.DataRows.count)
    
    DTB.save  '(这句代码会报错) 新增行无法保存
     
    
    
    messagebox.show("Successful. Order has been split into " & Totparts & " parts." , "Note", Messageboxbuttons.ok, MessageBoxIcon.Information)
     
    Return 0
End If 

 回到顶部