Neither code samples below work.... i am trying to use the second one
but it errors out ont he oleDBConnection.Getole..... line...

On Feb 10, 4:02 am, Mike Fry <mike...@iafrica.com> wrote:
> On 2012/02/10 08:43, crocboy25 wrote:
>
> > The next method I tried is using Microsoft.ACE.OLEDB.12.0.  It seems
> > to be able to find the file Book.xls but it can never find the sheet
> > to query from.  I left the Sheet name alone to stay as Sheet1.
> > Everytime I run the page it says "System.Data.OleDb.OleDbException:
> > The Microsoft Office Access database engine could not find the object
> > 'Sheet1$'. "
>
> I have been through this!
>
> Dim reader As OleDbDataReader = OleDbEnumerator.GetRootEnumerator()
> While reader.Read()
>    isamList.Add(reader.GetValue(0))
>    Console.WriteLine("{0} = {1}", reader.GetName(0), reader.GetValue(0))
> End While
>
> will give you a list of installed providers
>
> Dim schemaTable As DataTable =
> oledbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object()
> {Nothing, Nothing, Nothing, "TABLE"})
> If schemaTable.Rows.Count > 1 Then
>   You've got multiple sheets in a file
>
> Dim sheet As String = 
> schemaTable.Rows(selectedWorksheet)("TABLE_NAME").ToString()
>
> lets you select a sheet without knowing its name.
>
> --
> Regards,
> Mike Fry
> Johannesburg

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to dotnetdevelopment@googlegroups.com
To unsubscribe from this group, send email to
dotnetdevelopment+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to