Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "Excel文件|*.xls" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim c As Integer = 0
Dim Book As New XLS.Book(dlg.FileName)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("厂发货登记").StopRedraw()
'注意以下数组中列名称的顺序,必须和Excel表中的列顺序一致
Dim nms() As String = {"发货日期","车号","到站","规格","件数","吨位","实重","区号","货位","备注"}
'注意下面的循环变量从1开始,而不是从0开始,因为Excel表的第一行是标题
For n As Integer = 1 To Sheet.Rows.Count -1
Dim ch As String = sheet(n,1).Text
Dim gg As String = sheet(n,3).Text
Dim dw As String = sheet(n,5).Text
If DataTables("厂发货登记").Find("车号 = '" & ch & "' and 规格='" & gg & "' and 吨位=" & dw) Is Nothing Then '如果不存在同编号的订单
c = c + 1
Dim r As Row = Tables("厂发货登记").AddNew()
For m As Integer = 0 To nms.Length - 1
r(nms(m)) = Sheet(n,m).Value
Next
End If
Next
Tables("厂发货登记").ResumeRedraw()
DataTables("厂发货登记").Save
MessageBox.Show("导入完成,共导入" & c & "条记录")
End If
.NET Framework 版本:2.0.50727.3053
Foxtable 版本:2014.8.6.1
错误所在事件:窗口,厂发货登记,Button2,Click
详细错误信息:
Syntax error: Missing operand after '=' operator.