Foxtable(狐表)用户栏目专家坐堂 → 关于批量入库


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

主题:关于批量入库

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


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

那你直接取后面四位计算即可,如

 

Dim startno As String = e.Form.Controls("TextBox1").text
Dim endno As String = e.Form.Controls("TextBox2").text

If DataTables("流量卡资料库").Find("流量卡号 >= '" & startno & "' and 流量卡号 <= '" & endno & "'") Is Nothing Then
    Dim pfix As String = left(startno, startno.Length-4)
    Dim ka1 As Integer = right(startno, 4)
    Dim ka2 As Integer = right(Endno, 4)
    For i As Integer = ka1 To ka2
        Dim r As Row = Tables("流量卡资料库").AddNew
        r("服务商") = e.Form.Controls("TextBox4").text
        r("购买金额") = e.Form.Controls("TextBox3").text
        r("流量卡号") = pfix & i
    Next
Else
    msgbox("已存在卡号")
End If


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


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

以下是引用裴保民在2018/11/29 8:32:00的发言:
如何用多文本框将所有要入库的单品编号扫描或键盘输入到多文本框中然后单击保存按钮,将所有的单品一次性保存到数据库中呢?

 

1、编号之间,必须有分割符或者换行符;

 

2、那你就分割每一个编号后,循环每一个,增加行,保存数据。


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


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

以下是引用裴保民在2018/11/29 13:40:00的发言:
循环次数不是固定的怎么统计呢?

 

请举例说明。

 

上传一个对应实例,说明输入什么内容,最后得到什么效果。


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


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

Dim str = e.Form.controls("textbox3").text
For Each s As String In str.replace(chr(10), "").split(chr(13))
    Dim r As Row = Tables("流量卡资料库").AddNew
    r("服务商") = e.Form.Controls("TextBox1").text
    r("购买金额") = e.Form.Controls("TextBox2").text
    r("流量卡号") = s
Next

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:批量入库.foxdb


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


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

Dim str = e.Form.controls("textbox3").text
For Each s As String In str.replace(chr(10), "").split(chr(13))

    Dim r = DataTables("流量卡资料库").Find("流量卡号 = '" & s & "'")

    If r is nothing then r = dataTables("流量卡资料库").AddNew
    r("服务商") = e.Form.Controls("TextBox1").text
    r("购买金额") = e.Form.Controls("TextBox2").text
    r("流量卡号") = s
Next


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


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

Dim str = e.Form.controls("textbox3").text
For Each s As String In str.replace(chr(10), "").split(chr(13))    
    Dim r = DataTables("流量卡资料库").Find("流量卡号 = '" & s & "'")    
    If r Is Nothing Then        
        r = DataTables("流量卡资料库").AddNew
        r("服务商") = e.Form.Controls("TextBox1").text
        r("购买金额") = e.Form.Controls("TextBox2").text
        r("流量卡号") = s        
    Else        
        msgbox("重复了" & s)        
    End If      
Next


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


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

Dim str  = e.Form.controls("textbox3").text
For Each s As String In str.replace(chr(10), "").split(chr(13))
    Dim r = DataTables("流量卡资料库").Find("流量卡号 = '" & s & "'")
    If r IsNot Nothing Then
        msgbox("重复了" & s)
        Return
    End If
Next
For Each s As String In str.replace(chr(10), "").split(chr(13))
    Dim r = DataTables("流量卡资料库").AddNew
    r("服务商") = e.Form.Controls("TextBox1").text
    r("购买金额") = e.Form.Controls("TextBox2").text
    r("流量卡号") = s   
Next

 


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


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

For Each s As String In str.replace(chr(10), "").split(chr(13))

 

改成

 

For Each s As String In str.replace(chr(10), "").split(new char() {chr(13), ","})


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


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

Dim str = e.Form.controls("textbox3").text
For Each s As String In split(new Char() {chr(13), ","})
    If s > "" Then
        Dim r = DataTables("流量卡资料库").Find("流量卡号 = '" & s & "'")
        If r IsNot Nothing Then
            msgbox("重复了" & s)
            Return
        End If
    End If
Next
For Each s As String In str.split(new Char() {chr(13), ","})
    If s > "" Then
        Dim r = DataTables("流量卡资料库").AddNew
       r("服务商") = e.Form.Controls("TextBox1").text
        r("购买金额") = e.Form.Controls("TextBox2").text
        r("流量卡号") = s
    End If
Next


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


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

Dim str = e.Form.controls("textbox3").text
For Each s As String In str.split(new Char() {chr(13), ","})
    s = s.replace(chr(10), "").replace(chr(13), "")
    If s > "" Then
        Dim r = DataTables("流量卡资料库").Find("流量卡号 = '" & s & "'")
        If r IsNot Nothing Then
            msgbox("重复了" & s)
            Return
        End If
    End If
Next
For Each s As String In str.split(new Char() {chr(13), ","})
    s = s.replace(chr(10), "").replace(chr(13), "")
    msgbox(s)
    If s > "" Then
        Dim r = DataTables("流量卡资料库").AddNew
        r("服务商") = e.Form.Controls("TextBox1").text
        r("购买金额") = e.Form.Controls("TextBox2").text
        r("流量卡号") = s
    End If
Next

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