If strExtension = ".xls" Then MyConnection = New System.Data.OleDb.OleDbConnection _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFilePath & ";Extended Properties=""Excel 8.0;IMEX=1;;HDR=YES""") ElseIf strExtension = ".xlsx" Then MyConnection = New System.Data.OleDb.OleDbConnection _ ("provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strFilePath & ";Extended Properties=""Excel 12.0;IMEX=1;;HDR=YES""") ElseIf strExtension = ".xlsm" Then MyConnection = New System.Data.OleDb.OleDbConnection _ ("provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strFilePath & ";Extended Properties=""Excel 12.0 Macro;IMEX=1;;HDR=YES""") End If
Dim MyCommand As OleDbCommand = New OleDbCommand _ ("select * from [UserDetails$]", MyConnection) Dim dsChangedValues As New DataSet() Dim obj As OleDbDataAdapter = New OleDbDataAdapter(MyCommand) obj.Fill(dsChangedValues)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)