日期:2014-05-17 浏览次数:20443 次
Public Function Query(ByVal Sql As String) As DataSet
Dim ExcelPathFile As String = "D:\Text\20131114.xls"
Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ExcelPathFile + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"
Using connection As New OleDbConnection(ConnectionString)
Dim ds As New DataSet
Try
connection.Open()
Dim command As OleDbDataAdapter = New OleDbDataAdapter(Sql, connection)
command.Fill(ds, "ds")
Catch ex As System.Data.OleDb.OleDbException
Throw New Exception(ex.Message)
End Try
Return ds
End Using
End Function
Public Sub ImportDataBaseInfo()
'根据excel里面的字段,可以导入创建个临时表,先导入到临时表,然后再导入到实体表
Dim i As Integer = 0
Dim dt As DataTable
&nb