Foxtable(狐表)用户栏目专家坐堂 → 强制刷新问题


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

主题:强制刷新问题

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


加好友 发短信
等级:三尾狐 帖子:713 积分:5196 威望:0 精华:0 注册:2012/4/13 13:10:00
  发帖心情 Post By:2012/9/12 14:22:00 [只看该作者]

以下是引用狐狸爸爸在2012-9-8 17:04:00的发言:
你的意思是要填充有数据的列,没有数据的列就不填充?
如果这样:
 
 
If DataTables("出库").datarows.count < 1 Then
    messagebox.show("表中数据为空!")
Else
    Dim dr1 As DataRow
    Dim dt As DataTable = DataTables("出库")
    Dim r As Integer
    r = Tables("商品出库").FindRow("[出库日期] Is null", 0 , False ) '从当前行开始查找
    If r >= 0 Then '如果找到的话
        Tables("商品出库").Position = r '定位到找到的行.
        For Each dr As DataRow In dt.datarows
            dr1 = DataTables("商品出库").DataRows(r)
            For Each dc As DataCol In dt.datacols
                If dr.IsNull(dc.name) = False
                    dr1(dc.name) = dr(dc.name)
                End If
            Next
        Next
    Else
        For Each dr As DataRow In dt.datarows
            dr1 = DataTables("商品出库").DataRows.addnew()
            For Each dc As DataCol In dt.datacols
                If dr.IsNull(dc.name) = False
                    dr1(dc.name) = dr(dc.name)
                End If
            Next
        Next
    End If
    DataTables("商品出库").save()
    DataTables("出库").DataRows.Clear() '清除所有行
    DataTables("商品出库").DataCols("单价").RaiseDataColChanged()
    e.Form.Close()
End If

 

请问狐爸 ,如果不填充"商品出库"表中没有的列 该如何改呢?If dr1.IsNull(dc.name) = False 这样好像不对


 

[此贴子已经被作者于2012-9-12 14:22:36编辑过]

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


加好友 发短信
等级:三尾狐 帖子:713 积分:5196 威望:0 精华:0 注册:2012/4/13 13:10:00
  发帖心情 Post By:2012/9/12 15:17:00 [只看该作者]

没人帮忙解决下吗~~~图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/9/12 15:17:00 [只看该作者]

If DataTables("商品出库").DataCols.Contains(dc.Name) = False Then

End If


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


加好友 发短信
等级:三尾狐 帖子:713 积分:5196 威望:0 精华:0 注册:2012/4/13 13:10:00
  发帖心情 Post By:2012/9/12 15:44:00 [只看该作者]

以下是引用狐狸爸爸在2012-9-12 15:17:00的发言:

If DataTables("商品出库").DataCols.Contains(dc.Name) = False Then

End If

狐爸貌似不行啊,我运行了之后 还是提醒 入库里面的一列 不属于商品出库


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  15楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/9/12 16:17:00 [只看该作者]

你11楼的有两个地方用到,都改一下。

 

 

If DataTables("出库").datarows.count < 1 Then
    messagebox.show("表中数据为空!")
Else
    Dim dr1 As DataRow
    Dim dt As DataTable = DataTables("出库")
    Dim r As Integer
    r = Tables("商品出库").FindRow("[出库日期] Is null", 0 , False ) '从当前行开始查找
    If r >= 0 Then '如果找到的话
        Tables("商品出库").Position = r '定位到找到的行.
        For Each dr As DataRow In dt.datarows
            dr1 = DataTables("商品出库").DataRows(r)
            For Each dc As DataCol In dt.datacols
                If DataTables("商品出库").DataCols.Contains(dc.name) Then
                    If dr.IsNull(dc.name) = False
                        dr1(dc.name) = dr(dc.name)
                    End If
                End If
            Next
        Next
    Else
        For Each dr As DataRow In dt.datarows
            dr1 = DataTables("商品出库").DataRows.addnew()
            For Each dc As DataCol In dt.datacols
                If DataTables("商品出库").DataCols.Contains(dc.name) Then
                    If dr.IsNull(dc.name) = False
                        dr1(dc.name) = dr(dc.name)
                    End If
                End If
            Next
        Next
    End If
    DataTables("商品出库").save()
    DataTables("出库").DataRows.Clear() '清除所有行
    DataTables("商品出库").DataCols("单价").RaiseDataColChanged()
    e.Form.Close()
End If


 回到顶部
总数 15 上一页 1 2