loading excel gives unhandled exception

moos

Newcomer
Joined
Oct 29, 2003
Messages
1
Location
holland
hello!

who can help me with this problem?

this is what i'm trying to do

Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection

Private Sub jubileumgratificatie_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & "data source=C:\test.XLS; " & "Extended Properties=Excel 9.0;")
'select the data from sheet 2 of the workbook
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select*from[Sheet2$]", MyConnection)
DS = New System.Data.DataSet
MyCommand.Fill(DS) 'gives unhandled exception of type 'system.data.oledb.oledbexception' occurred in system.data.dll
MyConnection.Close()

End Sub

what is wrong?

thanks
 
Last edited:
Back
Top