Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog = DialogResult.OK Then
Dim Book As New XLS.Book(dlg.FileName)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
For n As Integer = 1 To Sheet.Rows.Count - 1
Dim db = HySql.DataBaseFactory.CreateDatabase()
Dim Sql = "se lect * from 运单管理 where [上游客户] = '" & sheet(n, 0).Value & "' And [商品车] = '" & sheet(n, 1).Value & "' And [VIN码] = '" & sheet(n, 2).Value & "' And [上游动态] = '" & sheet(n, 3).Value & "' And [二次] = 0 and [返单上游] = 0 "
Dim dt As System.Data.DataTable = db.ExecuteDataSet(Sql).Tables(0)
dt.TableName = "运单管理"
dt.Rows(0)("返单上游") = 1
dt.Rows(0)("返单上游号") = Tables ("返单上游").Current ("返单上游号")
dt.Rows(0)("返单上游操作员") = Tables ("返单上游").Current ("操作员")
dt.Rows(0)("返单上游日期") = Tables ("返单上游").Current ("操作日期")
db.UpdateDataTable(dt)
Next
Tables("返单上游_Table1").DataTable.Load
以上代码执行到dt.Rows(0)("返单上游") = 1这句时,会出现错误提示:
在位置 0 处没有任何行。