请老师指教,谢谢
Dim dlg As NewOpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog = DialogResult.OK Then
If Connections.Contains("test") Then
If DataTables.Contains("窗口1_Table1") Then DataTables.Unload("窗口1_Table1")
Connections.Delete("test")
End If
Connections.Add("test", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dlg.FileName & ";Extended Properties='Excel 8.0;HDR=yes'")
Dim q As New QueryBuilder
q.TableName = "窗口1_Table1"
q.SelectString = "Select * f rom [" & e.Sender.Text & "]"
q.Build
End IF
[此贴子已经被作者于2024/5/6 9:57:04编辑过]