Foxtable(狐表)用户栏目专家坐堂 → [求助]find中变量使用代码


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

主题:[求助]find中变量使用代码

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


加好友 发短信
等级:四尾狐 帖子:811 积分:10970 威望:0 精华:1 注册:2008/9/2 18:58:00
[求助]find中变量使用代码  发帖心情 Post By:2016/6/15 8:08:00 [只看该作者]

请教,下面的代码,不知道哪里错了?

 

 

Dim t1 As Table
t1 = e.form.Controls("Table2").Table
Dim F As String = t1.name
Dim dlg As New OpenFileDialog
dlg.MultiSelect = True
dlg.Filter= "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog = DialogResult.OK Then
    For Each km As String In DataTables(F).GetValues("接收数据列名","是否导入 = 'True'")
        For Each fl As String In dlg.FileNames
            Dim Book As New xls.Book(fl)
            Dim Sheet As XLS.Sheet = Book.Sheets(0)
            Dim nms As new Dictionary (of String,Integer)
           
            For i As Integer = 0 To Sheet.Cols.Count -1
                If Sheet(0,i).Value <> "" Then
                    nms.add(Sheet(0,i).Value.Trim(),i)
                   
                End If
            Next
           
            For n As Integer = 1 To Sheet.Rows.Count -1
                Dim M As String = e.Form.Controls("TextBox1").text
                Dim P As String = e.Form.Controls("TextBox2").text             

                Dim D As String = CurrentTable.name
               
                Dim sfz As String = sheet(n,nms(M)).Text  '获取身份证号
                Dim dr As DataRow = DataTables(D).Find("P = '" & sfz & "'")
                If dr IsNot Nothing
                    dr( km ) = sheet(n,nms(km)).text
                End If
            Next
        Next
                
    Next
End If

[此贴子已经被作者于2016/6/15 8:08:42编辑过]

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/6/15 8:33:00 [只看该作者]

Dim dr As DataRow = DataTables(D).Find(P & " = '" & sfz & "'")

 回到顶部