Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共17 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:[求助]复制

1楼
风声 发表于:2023/12/14 20:21:00
老师,下面代码勾选后只能复制三行,全部勾选也只能复制三行。

If e.DataCol.Name = "审核"
    If e.DataRow("审核") = True Then
        Dim dr1 As DataRow = DataTables("一号楼").find("项目ID='" & e.DataRow("项目ID") & "'")
        If dr1 Is Nothing Then
            Dim nma() As String = {"项目","项目ID","抄表日期","时段","年","月份"} 'A表数据来源列
            Dim nmb() As String = {"项目","项目ID","抄表日期","时段","年","月份"} '原材料数据接收列
            dr1  = DataTables("一号楼").AddNew
            For i As Integer = 0 To nma.Length - 1
                dr1(nmb(i)) = e.DataRow(nma(i))
            Next
        End If
    Else
        DataTables("一号楼").deletefor("项目ID='" & e.DataRow("项目ID") & "'")
    End If
End If

[此贴子已经被作者于2023/12/14 20:21:43编辑过]
2楼
有点蓝 发表于:2023/12/14 21:08:00
说明"一号楼"表已经有相同的项目ID数据存在
3楼
风声 发表于:2023/12/15 9:09:00
老师,我有了主键列后退勾不能删除数据。

If e.DataCol.Name = "审核"
    If e.DataRow("审核") = True Then
        Dim dr1 As DataRow = DataTables("一号楼").find("_Identify='" & e.DataRow("_Identify”) & "'")
        If dr1 Is Nothing Then
            Dim nma() As String = {"_Identify”,"项目","项目ID","抄表日期","时段","年","月份"} 'A表数据来源列
            Dim nmb() As String = {"_Identify”,"项目ID","抄表日期","时段","年","月份"} '原材料数据接收列
            dr1  = DataTables("一号楼").AddNew
            For i As Integer = 0 To nma.Length - 1
                dr1(nmb(i)) = e.DataRow(nma(i))
            Next
        End If
    Else
        DataTables("一号楼").deletefor("_Identify='" & e.DataRow("_Identify”) & "'")
    End If
End If
4楼
有点蓝 发表于:2023/12/15 9:13:00
上面代码是放在"一号楼"这个表事件里的?如果不是,不能使用"_Identify”做关联,每个表的"_Identify”数据都是独一无二,和其它表没有关系,不能用作数据关联
5楼
风声 发表于:2023/12/15 14:10:00
老师,下面代码用编号和id号当关联后退勾不能删除数据。

If e.DataCol.Name = "审核"
    If e.DataRow("审核") = True Then
        Dim dr1 As DataRow = DataTables("一号楼").find("ID='" & e.DataRow("编号”) & "'")
        If dr1 Is Nothing Then
            Dim nma() As String = {"编号”,"项目ID","抄表日期","时段","年","月份"} 
            Dim nmb() As String = {"ID”,"项目ID","抄表日期","时段","年","月份"} 
            dr1  = DataTables("一号楼").AddNew
            For i As Integer = 0 To nma.Length - 1
                dr1(nmb(i)) = e.DataRow(nma(i))
            Next
        End If
    Else
        DataTables("一号楼").deletefor("ID='" & e.DataRow("编号”) & "'")
    End If
End If

[此贴子已经被作者于2023/12/15 14:11:01编辑过]
6楼
有点蓝 发表于:2023/12/15 14:23:00
代码没有问题,说明"一号楼"没有等于这个编号的id数据

msgbox("ID='" & e.DataRow("编号”) & "'")
7楼
风声 发表于:2023/12/15 19:19:00
谢谢老师,在一个表里的列找不到一个没有重复的我想设置一列禁止重复的不知怎样搞。
8楼
风声 发表于:2023/12/16 9:14:00
老师好,下面代码打开项目总数给我重新复制一边,我只要外部数据表增加的数据导入数据汇总表。谢谢老师!

Dim cmd3 As New SQLCommand
Dim dt As DataTable
Dim sCols() As String = {"项目","项目ID","抄表日期","年","月份"}
Dim dCols() As String = {"项目","项目ID","日期","年","月"}
cmd3.C
cmd3.CommandText = "SELEC T * From {一号楼}"
dt = cmd3.ExecuteReader()
For Each dr As DataRow In dt.DataRows
    Dim nr As DataRow = DataTables("数据汇总").AddNew()
    For i As Integer =0 To sCols.Length -1
        nr(dCols(i)) = dr(sCols(i))
    Next
Next
9楼
有点蓝 发表于:2023/12/16 9:32:00
我只要外部数据表增加的数据导入数据汇总表】 --- 怎么知道哪些数据是新增加的
10楼
风声 发表于:2023/12/16 9:37:00
老师,被导出的外部数据表和另我一个内部数据表是关联的
共17 条记录, 每页显示 10 条, 页签: [1] [2]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .05078 s, 2 queries.