Foxtable(狐表)用户栏目专家坐堂 → 怎么实现是从DataTables(Vars("btname11"))表中查找T2表接收字段中如果有来源列数对应的值的 且是否唯一等于是 时 就跳过 反之是否唯一不等于是就新建呢?


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

主题:怎么实现是从DataTables(Vars("btname11"))表中查找T2表接收字段中如果有来源列数对应的值的 且是否唯一等于是 时 就跳过 反之是否唯一不等于是就新建呢?

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
怎么实现是从DataTables(Vars("btname11"))表中查找T2表接收字段中如果有来源列数对应的值的 且是否唯一等于是 时 就跳过 反之是否唯一不等于是就新建呢?  发帖心情 Post By:2021/11/22 12:11:00 [显示全部帖子]

怎么实现是从DataTables(Vars("btname11"))表中查找T2表接收字段中如果有来源列数对应的值的  且是否唯一等于是 时 就跳过   反之是否唯一不等于是就新建呢?

当前代码如下:
Dim r As Row
Dim i,j As Integer
Dim t1,t2 As Table
Dim str1,str2 As String
Dim str As String
t1 = Tables(Vars("btname11"))
t2 = e.form.Controls("Table1").Table
str1 = e.form.Controls("TextBox1").value
str2 = e.form.Controls("ComboBox1").value
Dim prb As WinForm.ProgressBar = e.Form.Controls("ProgressBar1")
If str1 = "" OrElse str2 = "" Then
    Return
End If
Dim Book As New XLS.Book(str1)
Dim Sheet As XLS.Sheet = Book.Sheets(str2)
If e.Form.Controls("CheckBox1").checked = False Then
    For Each r In t2.Rows
        If r.IsNull("来源字段") OrElse r.IsNull("接收字段") Then
            MessageBox.Show("字段匹配未完成!")
            Return
        End If
    Next
    prb.Visible = True
    prb.Maximum = Sheet.Rows.Count - 1
    
    
    Dim s11 As String
    For Each c1 As Col In t1.Cols
        s11 = s11 & "," & c1.name
    Next
    s11 = s11.trim(",")
    Dim cs As String =  s11
    msgbox(cs)
    
    
    Dim s22 As String
    Dim zd1 As New Dictionary(Of Integer, String)
    For i = 0 To Sheet.Cols.count - 1
        If Sheet(0,i).text > ""
            zd1.Add(i,Sheet(0,i).Value)
            s22 = s22 & "," &  Sheet(0,i).Value
        End If
    Next
    s22 = s22.trim(",")
    Dim cs22 As String =  s22
    msgbox(cs22)
    
    Dim filter As String = "1=2"
    Dim ss11() As String = s11.split(",")
    Dim s111 As String = ss11(0)
    
    Dim ss22() As String = s22.split(",")
    Dim s222 As String = ss22(0)
    
    For i11 As Integer = 0 To ss11.length -1
        For i22 As Integer = 0 To ss22.length -1
            filter = filter & " or " & ss11(i11) & " <> " & ss22(i22)
        Next
    Next
    msgbox(filter)
           
    For i = 1 To Sheet.Rows.Count -1
        Dim dr As DataRow = DataTables(Vars("btname11")).Find(filter)   '在这里怎么写find条件
        If dr Is Nothing Then '如果不存在同编号的订单
            r = t1.AddNew()
            For j = 0 To t2.Rows.count - 1
                Dim ss As String  =Sheet(i,t2.Rows(j)("来源列数")).Value
                r(t2.Rows(j)("接收字段")) = ss.Replace(" ", "").Trim
            Next
        Else
            MessageBox.Show("存在相同内容,即将跳过")
        End If
        prb.Value = i
    Next
    
    
Else
    For j = 0 To Sheet.Cols.count - 1
        If t1.cols.Contains(Sheet(0,j).value) Then
            If str = "" Then
                str = Sheet(0,j).value
                str = str.Replace(" ", "").Trim
            Else
                str = str & "," & Sheet(0,j).value
                str = str.Replace(" ", "").Trim
            End If
        End If
    Next
    If str = "" Then
        MessageBox.Show("对不起,没有匹配字段!")
        Return
    End If
    If MessageBox.Show("是否只导入匹配字段?","询问",MessageBoxButtons.YesNo,MessageBoxIcon.Question) = DialogResult.Yes Then
        prb.Visible = True
        prb.Maximum = Sheet.Rows.Count - 1
        For i = 1 To Sheet.Rows.Count -1
            r = t1.AddNew()
            For j = 0 To str.split(",").Length - 1
                Dim sss As String =Sheet(i,j).Value
                r(str.split(",")(j)) = sss.Replace(" ", "").Trim
            Next
            prb.Value = i
        Next
    Else
        Return
    End If
End If
t1.DataTable.save
MessageBox.Show("数据导入完毕!")
'e.Form.close

上述得到的内容:
不想显示所有的表列名  只想显示对应已经选择了接收字段的匹配列名  其他没有匹配的不显示

想实现的预期效果不是如图这样的那么多字段内容,只想实现就已经选择的来源字段和接收字段之间的不存在重复值就如下:
怎么实现是从DataTables(Vars("btname11"))表中查找T2表接收字段中如果有来源列数对应的值的  且是否唯一等于是 时 就跳过   反之是否唯一不等于是就新建呢?
For i = 1 To Sheet.Rows.Count -1               
        Dim dr As DataRow = DataTables(Vars("btname11")).Find(“”)   '在这里怎么写find条件
        If dr Is Nothing Then '如果不存在同编号的订单
            r = t1.AddNew()
            For j = 0 To t2.Rows.count - 1
                  Dim ss As String  =Sheet(i,t2.Rows(j)("来源列数")).Value
                  r(t2.Rows(j)("接收字段")) = ss.Replace(" ", "").Trim
             Next
        Else
            MessageBox.Show("存在相同内容,即将跳过")
        End If
        prb.Value = i
 Next

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)使用字典记录需要的列名  发帖心情 Post By:2021/11/22 18:43:00 [显示全部帖子]

Dim zd1 As New Dictionary(Of Integer, String)
zd1.Add(“a”,“b”)

具体怎么操作呢?还要麻烦老师指导下,谢谢!项目文件目前也发不上来

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)参考这里的用法,看看是怎么生成和勾...  发帖心情 Post By:2021/11/23 11:16:00 [显示全部帖子]

还得麻烦老师指导下   看了一下  没有得到头绪
学习了复合选择框的方法   对于表操作没有头绪
    Dim s As String
    Dim filter As String
    Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
    Dim idx As Integer = 0
    For Each Index As Integer In l.CheckedIndices
        Dim c As String = l.Items(Index)
        s = s & "|" & c
        If filter > "" Then filter = filter & " and "
        If DataTables(Vars("btname")).datacols(c).IsNumeric
            filter = filter & c & "={" & idx & "}"
        ElseIf DataTables(Vars("btname")).datacols(c).IsDate
            filter = filter & c & "=#{" & idx & "}#"
        Else
            filter = filter & c & "='{" & idx & "}'"
        End If
        idx += 1
    Next
    s = s.trim("|")
    Dim dr As DataRow
    生成"比对表"的代码
    For Each sr() As String In DataTables(Vars("btname")).GetValues(s)
        dr = DataTables(Vars("btname")).find(CExp(filter,sr))
        If dr IsNot Nothing Then
            Dim r As Row = Tables("比对表").addnew
            For Each dc As Col In Tables(Vars("btname")).Cols
                r(dc.name) = dr(dc.name)
            Next
        End If
    Next

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)一样的东西,遍历列表框【For Each I...  发帖心情 Post By:2021/11/23 12:27:00 [显示全部帖子]


还是没有成功实现,还得麻烦老师辛苦一下  谢谢!
Dim i,j As Integer
Dim t1,t2 As Table
Dim str1,str2 As String
Dim str As String
t1 = Tables(Vars("btname11"))
t2 = e.form.Controls("Table1").Table
str1 = e.form.Controls("TextBox1").value
str2 = e.form.Controls("ComboBox1").value
Dim s As String
Dim filter As String
Dim l As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
Dim idx As Integer = 0
Dim Vals As List(of String)
Vals = t2.DataTable.GetValues("来源字段")
For Index As Integer = 0 To Vals.Count - 1
    Dim c As String = Vals(Index)
    MessageBox.Show(c)
    s = s & "|" & c
    If filter > "" Then filter = filter & " and "
    If DataTables(Vars("btname")).datacols(c).IsNumeric
        filter = filter & c & "={" & idx & "}"
    ElseIf DataTables(Vars("btname")).datacols(c).IsDate
        filter = filter & c & "=#{" & idx & "}#"
    Else
        filter = filter & c & "='{" & idx & "}'"
    End If
    MessageBox.Show(filter)
    idx += 1
Next
s = s.trim("|")
MessageBox.Show(s)
Dim dr As DataRow
生成"比对表"的代码
For Each sr() As String In DataTables(Vars("btname")).GetValues(s)
    dr = DataTables(Vars("btname")).find(CExp(filter,sr))
    If dr IsNot Nothing Then
        Dim r As Row = Tables("比对表").addnew
        For Each dc As Col In Tables(Vars("btname")).Cols
            r(dc.name) = dr(dc.name)
        Next
    End If
Next


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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)什么地方有问题?  发帖心情 Post By:2021/11/23 14:54:00 [显示全部帖子]

错误提示:
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:窗口,导入Excel,Button6,Click
详细错误信息:
重载决策失败,因为没有最适合这些参数的 Public“Item”: 
    'Public ReadOnly Property Item(Index As Integer) As Foxtable.DataTable':
        不是最特定的。
    'Public ReadOnly Property Item(TableName As String) As Foxtable.DataTable':
        不是最特定的。

图片点击可在新窗口打开查看此主题相关图片如下:12.gif
图片点击可在新窗口打开查看

当前代码:【table1是窗体表,来源字段来源列数都从这里获取】
Dim i,j As Integer
Dim t1,t2 As Table
Dim str1,str2 As String
Dim str As String
t1 = Tables(Vars("btname11"))
t2 = e.form.Controls("Table1").Table
str1 = e.form.Controls("TextBox1").value
str2 = e.form.Controls("ComboBox1").value
Dim s As String
Dim filter As String
Dim idx As Integer = 0
Dim Vals As List(of String)
Vals = t2.DataTable.GetValues("来源字段")
MessageBox.Show(Vals.Count)
For Index As Integer = 0 To Vals.Count - 1
    Dim c As String = Vals(Index)
    MessageBox.Show(c)
    MessageBox.Show(1)
    s = s & "|" & c
    MessageBox.Show(2)
    MessageBox.Show(s)
    If filter > "" Then filter = filter & " and "
    If DataTables(Vars("btname")).datacols(c).IsNumeric
        filter = filter & c & "={" & idx & "}"
    ElseIf DataTables(Vars("btname")).datacols(c).IsDate
        filter = filter & c & "=#{" & idx & "}#"
    Else
        filter = filter & c & "='{" & idx & "}'"
    End If
    MessageBox.Show(filter)
    idx += 1
Next
s = s.trim("|")
MessageBox.Show(3)
MessageBox.Show(s)
Dim dr As DataRow
'生成"比对表"的代码
'For Each sr() As String In DataTables(Vars("btname")).GetValues(s)
'dr = DataTables(Vars("btname")).find(CExp(filter,sr))
'If dr IsNot Nothing Then
'Dim r As Row = Tables("比对表").addnew
'For Each dc As Col In Tables(Vars("btname")).Cols
'r(dc.name) = dr(dc.name)
'Next
'End If
'Next

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)什么地方有问题?  发帖心情 Post By:2021/11/23 15:11:00 [显示全部帖子]

操作二:
图片点击可在新窗口打开查看
当前代码修正为:
Dim i,j As Integer
Dim t1,t2 As Table
Dim str1,str2 As String
Dim str As String
t1 = Tables(Vars("btname11"))
t2 = e.form.Controls("Table1").Table
str1 = e.form.Controls("TextBox1").value
str2 = e.form.Controls("ComboBox1").value
Dim s As String
Dim filter As String
Dim idx As Integer = 0
Dim Vals As List(of String)
Vals = t2.DataTable.GetValues("来源字段")
MessageBox.Show(Vals.Count)
For Index As Integer = 0 To Vals.Count - 1
    Dim c As String = Vals(Index)
    MessageBox.Show(c)
    MessageBox.Show(1)
    s = s & "|" & c
    MessageBox.Show(2)
    MessageBox.Show(s)
    If filter > "" Then filter = filter & " and "   
    If t2.DataTable.datacols(c).IsNumeric        ‘红色部分换成这个DataTables(vars("btname11")).一样提示如图
        filter = filter & c & "={" & idx & "}"
    ElseIf t2.DataTable.datacols(c).IsDate       ‘红色部分换成这个DataTables(vars("btname11")).一样提示如图’
        filter = filter & c & "=#{" & idx & "}#"
    Else
        filter = filter & c & "='{" & idx & "}'"
    End If
    MessageBox.Show(filter)  弹不出来提示
    idx += 1
Next
s = s.trim("|")
MessageBox.Show(3)
MessageBox.Show(s)
Dim dr As DataRow
'生成"比对表"的代码
'For Each sr() As String In DataTables(Vars("btname")).GetValues(s)
'dr = DataTables(Vars("btname")).find(CExp(filter,sr))
'If dr IsNot Nothing Then
'Dim r As Row = Tables("比对表").addnew
'For Each dc As Col In Tables(Vars("btname")).Cols
'r(dc.name) = dr(dc.name)
'Next
'End If
'Next
运行如图:【还是错误!】

图片点击可在新窗口打开查看此主题相关图片如下:12.gif
图片点击可在新窗口打开查看

[此贴子已经被作者于2021/11/23 15:13:07编辑过]

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)For Index As Integer = 0 To Vals.C...  发帖心情 Post By:2021/11/23 15:33:00 [显示全部帖子]

图片点击可在新窗口打开查看
一条数据会生成两条数据  且数据列错位   当前窗体中选择的接收字段只有姓名和证照号码  结果生成如图数据

当前代码如下:
Dim i,j As Integer
Dim t1,t2 As Table
Dim str1,str2 As String
Dim str As String
t1 = Tables(Vars("btname11"))
t2 = e.form.Controls("Table1").Table
str1 = e.form.Controls("TextBox1").value
str2 = e.form.Controls("ComboBox1").value
Dim s As String
Dim filter As String
Dim idx As Integer = 0
Dim Vals As List(of String)
Vals = t2.DataTable.GetValues("接收字段")
'MessageBox.Show(Vals.Count)
For Index As Integer = 0 To Vals.Count - 1
    Dim c As String = Vals(Index)
    'MessageBox.Show(c)
    'MessageBox.Show(1)
    s = s & "|" & c
    'MessageBox.Show(2)
    'MessageBox.Show(s)
    If filter > "" Then filter = filter & " and "
    If DataTables(vars("btname11")).datacols(c).IsNumeric
        filter = filter & c & "={" & idx & "}"
    ElseIf DataTables(vars("btname11")).datacols(c).IsDate
        filter = filter & c & "=#{" & idx & "}#"
    Else
        filter = filter & c & "='{" & idx & "}'"
    End If
    MessageBox.Show(filter)
    idx += 1
Next
s = s.trim("|")
'MessageBox.Show(3)
MessageBox.Show(s)
Dim dr As DataRow
For Each sr() As String In DataTables(Vars("btname11")).GetValues(s)
    dr = DataTables(Vars("btname11")).find(CExp(filter,sr))
    If dr IsNot Nothing Then
        Dim r As Row = Tables(Vars("btname11")).addnew
        For Each dc As Col In Tables(Vars("btname11")).Cols
            r(dc.name) = dr(dc.name)
        Next
    End If
Next


[此贴子已经被作者于2021/11/24 2:23:01编辑过]

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)For Index As Integer = 0 To Vals.C...  发帖心情 Post By:2021/11/23 16:03:00 [显示全部帖子]

方法二:当选择了姓名和证照号码列之后  还是没有实现数据重复值的排除
麻烦老师帮忙看看 

以下内容是专门发给有点蓝浏览


Dim i,j As Integer
Dim t1,t2 As Table
Dim str1,str2 As String
Dim str As String
t1 = Tables(Vars("btname11"))
t2 = e.form.Controls("Table1").Table
str1 = e.form.Controls("TextBox1").value
str2 = e.form.Controls("ComboBox1").value
Dim s As String
Dim filter As String
Dim idx As Integer = 0
Dim Vals As List(of String)
Dim Book As New XLS.Book(str1)
Dim Sheet As XLS.Sheet = Book.Sheets(str2)
Vals = t2.DataTable.GetValues("接收字段")
'MessageBox.Show(Vals.Count)
For Index As Integer = 0 To Vals.Count - 1
    Dim c As String = Vals(Index)
    'MessageBox.Show(c)
    'MessageBox.Show(1)
    s = s & "|" & c
    'MessageBox.Show(2)
    'MessageBox.Show(s)
    If filter > "" Then filter = filter & " and "
    If DataTables(vars("btname11")).datacols(c).IsNumeric
        filter = filter & c & "={" & idx & "}"
    ElseIf DataTables(vars("btname11")).datacols(c).IsDate
        filter = filter & c & "=#{" & idx & "}#"
    Else
        filter = filter & c & "='{" & idx & "}'"
    End If
    MessageBox.Show(filter)
    idx += 1
Next
s = s.trim("|")
'MessageBox.Show(3)
MessageBox.Show(s)
Dim dr As DataRow
For Each sr() As String In DataTables(Vars("btname11")).GetValues(s)
    dr = DataTables(Vars("btname11")).find(CExp(filter,sr))
    If dr IsNot Nothing Then
        For i = 1 To Sheet.Rows.Count -1
            Dim r As Row = Tables(Vars("btname11")).addnew
            For j = 0 To t2.Rows.count - 1
                Dim ss As String  =Sheet(i,t2.Rows(j)("来源列数")).Value
                r(t2.Rows(j)("接收字段")) = ss.Replace(" ", "").Trim
            Next
        Next
    End If
Next


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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)不能直接从execl文件里排重,先把exe...  发帖心情 Post By:2021/11/23 16:40:00 [显示全部帖子]

我是想实现如下:

当前项目已经有一个表   名册
选择基础数据表excel文件
然后选择对应的姓名  证照号码字段进行来源和接收字段的匹配
然后开始导入数据
在导入数据的时候  进行判断 对应的指定条件   比如证照号码  是“唯一值”时,【接收字段是否唯一列值内容,需要可以灵活选择,不是每次都固定证照号码是唯一值,有可能是姓名为唯一值】就要先判断项目表名册里面是否有对应的身份证号值,如果有就不写入该值的数据,如果不存在该身份证号再将excel表数据进行导入。

老师有没有办法呢?这个问题纠结了好几天了  都还是没有找到合适的解决办法


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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)Dim i,j As IntegerDim t1,t2 As Tab...  发帖心情 Post By:2021/11/24 2:22:00 [显示全部帖子]

谢谢老师的耐心指导     根据老师的指导 我试着完成选择同一结构的表  自动匹配 操作数据导入  同样在导入的时候进行先判断项目目标表中是否有同样值的数据,如果有就不写入了  如果没有就写入   操作出现错误提示   麻烦老师继续指导下    谢谢!


当前代码如下:
Dim r As Row
Dim i,j As Integer
Dim t1,t2 As Table
Dim str1,str2 As String
Dim str As String
t1 = Tables(Vars("btname11"))
t2 = e.form.Controls("Table1").Table
str1 = e.form.Controls("TextBox1").value
str2 = e.form.Controls("ComboBox1").value
Dim prb As WinForm.ProgressBar = e.Form.Controls("ProgressBar1")
If str1 = "" OrElse str2 = "" Then
    Return
End If
Dim Book As New XLS.Book(str1)
Dim Sheet As XLS.Sheet = Book.Sheets(str2)
If e.Form.Controls("CheckBox1").checked = False Then
    For Each r In t2.Rows
        If r.IsNull("来源字段") OrElse r.IsNull("接收字段") Then
            MessageBox.Show("字段匹配未完成!")
            Return
        End If
    Next
    Dim dr As DataRow
    For i = 1 To Sheet.Rows.Count -1
        Dim sss As String = ""
        prb.Visible = True
        prb.Maximum = Sheet.Rows.Count - 1
        For j = 0 To t2.Rows.count - 1
            If sss > "" Then sss = sss & " and "
            sss = sss & t2.Rows(j)("接收字段") & "='" & Sheet(i,t2.Rows(j)("来源列数")).Value & "'"
            'MessageBox.Show(sss)
        Next
        dr = DataTables(Vars("btname11")).find(sss)
        If dr Is Nothing Then
            Dim r1 As Row = Tables(Vars("btname11")).addnew
            For j = 0 To t2.Rows.count - 1
                Dim ss As String  =Sheet(i,t2.Rows(j)("来源列数")).Value
                r(t2.Rows(j)("接收字段")) = ss.Replace(" ", "").Trim
            Next
        End If
        prb.Value=i
    Next
    t1.DataTable.save
    MessageBox.Show("数据导入完毕!")
Else
    For j = 0 To Sheet.Cols.count - 1
        If t1.cols.Contains(Sheet(0,j).value) Then
            If str = "" Then
                str = Sheet(0,j).value
                str = str.Replace(" ", "").Trim
            Else
                str = str & "," & Sheet(0,j).value
                str = str.Replace(" ", "").Trim
            End If
        End If
    Next
    If str = "" Then
        MessageBox.Show("对不起,没有匹配字段!")
        Return
    End If
    If MessageBox.Show("是否只导入匹配字段?","询问",MessageBoxButtons.YesNo,MessageBoxIcon.Question) = DialogResult.Yes Then
        Dim dr As DataRow
        For i = 1 To Sheet.Rows.Count -1
            Dim sss As String = ""
            prb.Visible = True
            prb.Maximum = Sheet.Rows.Count - 1
            MessageBox.Show(str)
            MessageBox.Show(str.split(",").Length)
            For j = 0 To str.split(",").Length - 1
                'Dim sss As String =""
                If sss > "" Then sss = sss & " and "
                MessageBox.Show(sss)
                MessageBox.Show(r(str.split(",")(j)))   
                'sss = sss & r(str.split(",")(j)) & "='" & sss.Replace(" ", "").Trim & "'"
                sss = sss & r(str.split(",")(j)) & "='" & Sheet(i,t2.Rows(j)("来源列数")).Value & "'"
                
                
                MessageBox.Show(sss)
            Next
            dr = DataTables(Vars("btname11")).find(sss)
            If dr Is Nothing Then
                r = t1.AddNew()
                For j = 0 To str.split(",").Length - 1
                    r(str.split(",")(j)) = sss.Replace(" ", "").Trim
                Next
                prb.Value = i
            End If
        Next
    Else
        Return
    End If
End If
t1.DataTable.save
MessageBox.Show("数据导入完毕!")
'e.Form.close



上述代码运行提示错误:经查主要是红色部分代码出错
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:窗口,主窗口,Button4,Click
详细错误信息:
未将对象引用设置到对象的实例。


图片点击可在新窗口打开查看此主题相关图片如下:121.gif
图片点击可在新窗口打开查看


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