大概如此:
Dim TEL,IDT as string
Dim cmd As New SQLCommand
Dim Book As New XLS.Book("D:\學生表.xls") '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
For i As
Integer = 1 To Sheet.Rows.count IDT =
Sheet(i, 0).Value
TEL
= Sheet(i, 2).Value
if IDT is Nothing then
Exit for
End if
cmd.CommandText = "UPDATE {學生表} SET 電話 = '" & TEL & "' WHERE 學號 ='" & IDT & "'"
cmd.ExecuteNonQuery()
Next
DataTables ("學生表").Load()