Foxtable(狐表)用户栏目专家坐堂 → [原创]代码问题


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

主题:[原创]代码问题

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 14:03:00 [显示全部帖子]

For Each r As Row In Tables("ZJJHB").GetCheckedRows
    Dim nma() As String = { "KSJM","KSMC","XMBM","XMMC","JHBH","HTJE","SQDW","XMJD","YFJDK" } 'A表数据来源列
    Dim nmb() As String = { "KSBM","KSMC","XMBM","XMMC","ZJJHBH","HT1","JSGLDW","HT3","HT4" } 'B表数据接收列
    Dim dr As DataRow = DataTables("ZJSQB").AddNew
    For i As Integer = 0 To nma.Length - 1
        dr(nmb(i)) = r(nma(i))
    Next
Next

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 14:55:00 [显示全部帖子]

 参考,转一下即可。

 

http://www.foxtable.com/help/topics/1345.htm

 


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 15:05:00 [显示全部帖子]

If User.IsRole("录入人") Then
    For Each r As Row In Tables("ZJJHB").GetCheckedRows
        Dim nma() As String = { "KSJM","KSMC","XMBM","XMMC","JHBH","HTJE","SQDW","XMJD","YFJDK" } 'A表数据来源列
        Dim nmb() As String = { "KSBM","KSMC","XMBM","XMMC","ZJJHBH","HT1","JSGLDW","HT3","HT4" } 'B表数据接收列
        Dim dr As DataRow = DataTables("ZJSQB").AddNew
        For i As Integer = 0 To nma.Length - 1
            dr(nmb(i)) = r(nma(i))
        Next
    Next 
Else
    MessageBox.show("你没有复制数据的权限!")
End If

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 15:06:00 [显示全部帖子]

同表也一样写,表名改一下即可。


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 15:33:00 [显示全部帖子]

以下是引用爱相随在2014-8-5 15:29:00的发言:
谢谢老师,还有,如果我要记录次数,比如对同一记录复制的次数达3次时,进行提示或限制,代码怎么加呢??

 

加入一列次数,用于统计被复制的次数

 

If User.IsRole("录入人") Then
    For Each r As Row In Tables("ZJJHB").GetCheckedRows
        Dim nma() As String = { "KSJM","KSMC","XMBM","XMMC","JHBH","HTJE","SQDW","XMJD","YFJDK" } 'A表数据来源列
        Dim nmb() As String = { "KSBM","KSMC","XMBM","XMMC","ZJJHBH","HT1","JSGLDW","HT3","HT4" } 'B表数据接收列
        Dim dr As DataRow = DataTables("ZJSQB").AddNew
       
        If r("次数") < 3 Then
            r("次数") += 1
            For i As Integer = 0 To nma.Length - 1
                dr(nmb(i)) = r(nma(i))
            Next
        Else
            msgbox("超出次数")
        End If
    Next
Else
    MessageBox.show("你没有复制数据的权限!")
End If

 


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 16:01:00 [显示全部帖子]

 

[此贴子已经被作者于2014-8-5 16:03:06编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 16:03:00 [显示全部帖子]

以下是引用爱相随在2014-8-5 15:56:00的发言:
对了,老师,表达不清楚,是连续复制3次,进行限制,间隔1-2月后则又可复制

 

加入一列日期列

 

If User.IsRole("录入人") Then
    For Each r As Row In Tables("ZJJHB").GetCheckedRows
        Dim nma() As String = { "KSJM","KSMC","XMBM","XMMC","JHBH","HTJE","SQDW","XMJD","YFJDK" } 'A表数据来源列
        Dim nmb() As String = { "KSBM","KSMC","XMBM","XMMC","ZJJHBH","HT1","JSGLDW","HT3","HT4" } 'B表数据接收列
        Dim dr As DataRow = DataTables("ZJSQB").AddNew
       
        If r("日期") < Date.Today.AddMonths(-1) Then

            r("次数") = 0
        End If
        If r("次数") < 3  Then
            r("次数") += 1
            For i As Integer = 0 To nma.Length - 1
                dr(nmb(i)) = r(nma(i))
            Next
        Else
            r("日期") = Date.Today
            msgbox("超出次数")
        End If
    Next
Else
    MessageBox.show("你没有复制数据的权限!")
End If


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 16:31:00 [显示全部帖子]

If User.IsRole("录入人") Then
    For Each r As Row In Tables("ZJJHB").GetCheckedRows
        Dim nma() As String = { "KSJM","KSMC","XMBM","XMMC","JHBH","HTJE","SQDW","XMJD","YFJDK" } 'A表数据来源列
        Dim nmb() As String = { "KSBM","KSMC","XMBM","XMMC","ZJJHBH","HT1","JSGLDW","HT3","HT4" } 'B表数据接收列
        Dim dr As DataRow = DataTables("ZJSQB").AddNew
       
        If r("日期") < Date.Today.AddMonths(-1) Then
            r("日期") = Date.Today
            r("次数") = 0
        End If
        If r("次数") < 3  Then
            r("次数") += 1
            For i As Integer = 0 To nma.Length - 1
                dr(nmb(i)) = r(nma(i))
            Next
        Else
            r("日期") = Date.Today
            msgbox("超出次数")
        End If
    Next
Else
    MessageBox.show("你没有复制数据的权限!")
End If


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 16:57:00 [显示全部帖子]

 不能新增行?你代码的意思是勾选了ZJJHB的行进行新增,你得先勾选

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/8/5 17:08:00 [显示全部帖子]

改一下代码

 

If User.IsRole("录入人") Then
    For Each r As Row In Tables("ZJJHB").GetCheckedRows
        Dim nma() As String = { "KSJM","KSMC","XMBM","XMMC","JHBH","HTJE","SQDW","XMJD","YFJDK" } 'A表数据来源列
        Dim nmb() As String = { "KSBM","KSMC","XMBM","XMMC","ZJJHBH","HT1","JSGLDW","HT3","HT4" } 'B表数据接收列
        Dim dr As DataRow = DataTables("ZJSQB").AddNew
       
        If r("日期") < Date.Today.AddMonths(-1) Then
            r("日期") = Date.Today
            r("次数") = 0
        End If
        If r("次数") < 3  Then
            r("次数") += 1
            For i As Integer = 0 To nma.Length - 1
                dr(nmb(i)) = r(nma(i))
            Next
        Else
            r("日期") = Date.Today
            msgbox("超出次数")
        End If
    Next
Else
    MessageBox


 回到顶部
总数 18 1 2 下一页