以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]无法解释位置 5 的标记 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=117775) |
-- 作者:blsu33 -- 发布时间:2018/4/19 8:30:00 -- [求助]无法解释位置 5 的标记 老师, 导入提示 .NET Framework 版本:2.0.50727.8794 Foxtable 版本:2018.3.9.1 错误所在事件:窗口,窗口1,Button1,Click 详细错误信息: 无法解释位置 5 的标记“"”。 劳烦您给看看,那里的问题? 为什么去掉“/”不成功呢? cnames &= sheet(1, i).text.trim("/") & "=" & """" & Sheet(n,i).text & """" & " and " 导入模板 [此贴子已经被作者于2018/4/19 9:06:59编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/4/19 8:50:00 -- Dim dlg As New OpenFileDialog dlg.Filter = "Excel文件|*.xls;*.xlsx" If dlg.ShowDialog =DialogResult.OK Then Dim Book As New XLS.Book(dlg.FileName) For Each sheet As xls.sheet In book.sheets If DataTables.Contains(sheet.name)=True Then Dim t As Table = Tables(sheet.name) t.ResumeRedraw() t.StopRedraw() For n As Integer =2 To Sheet.Rows.Count -4 Dim cnames As String="1=1" For i As Integer = 0 To sheet.Cols.Count -1 cnames &= " and " & sheet(1, i).text.replace("/", "") & "=" & "\'" & Sheet(n,i).text & "\'" Next MessageBox.Show(cnames) Dim drs As DataRow=DataTables(sheet.name).Find(cnames) MessageBox.Show(1) If drs Is Nothing Then Dim r As DataRow= t.DataTable.AddNew() For i As Integer = 0 To sheet.Cols.Count -1 Dim cname As String = sheet(1, i).text.replace("/", "") If cname > "" AndAlso t.Cols.Contains(cname) Then r(cname)= sheet(n, i).Text End If Next End If Next t.ResumeRedraw() End If Next End If |