ADO.NET error

kasteel

Well-known member
Joined
May 29, 2009
Messages
50
Programming Experience
10+
Hi

I get the following error: "The Microsoft Jet database engine could not find the object 'TextImportSheet'. Make sure the object exists and that you spell its name and the path name correctly."

The code:

VB.NET:
Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                   "Data Source=c:\logs\book1.xls;Extended Properties=""Excel 8.0;HDR=NO;""")

        ExcelConnection.Open()

        Dim ImportCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO [TextImportSheet] (SwipeCard,FirstName,LastName,Faculty,Degree,IDNr,EndDate,mail) SELECT * FROM [Text;HDR=NO;DATABASE=c:\logs\import].[output.txt]", ExcelConnection)

        ImportCommand.ExecuteNonQuery()
        ExcelConnection.Close()

My excel sheet is called TextImportSheet and is definitly spelled correctly. (I only have 1 sheet)

Any help would be appreciated.
 
Working now. HDR=NO > HDR=YES


VB.NET:
   Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\logs\book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""")

        ExcelConnection.Open()

        Dim ImportCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO [TextImportSheet$] (SwipeCard,FirstName,LastName,Faculty,Degree,IDNr,EndDate,mail) SELECT * FROM [Text;HDR=YES;DATABASE=c:\logs\import].[output.txt]", ExcelConnection)

        ImportCommand.ExecuteNonQuery()
        ExcelConnection.Close()
 
Back
Top