Dim dbadp As New OleDbTableAdapter("Select * From Sheet1$", "provider=Microsoft.Jet.OLEDB.4.0;Data Source='Your Filename';Extended Properties=Excel 8.0;")
Dim dTable As New DataTable
dbadp.Fill(dTable)
dbadp.dispose()
For i As Integer = 0 To dTable.Rows.Count - 1
dbcmd.commandtext = "Update SQLTable Set OrderNo=" & dTable.Rows(i).Item("OrderNo") & " Where ItemNo=" & dTable.Rows(i).Item("ItemNo") & " AND Location='" & dTable.Rows(i).Item("Location") & "'"
dbcmd.ExecuteNonQuery()
Next
|