Home All Groups Group Topic Archive Search About

how to create a table in excel?

Author
9 Nov 2006 8:56 PM
Britt
Hi,

I use this connection string to connect to excel:

ConnectionString="Provider = Microsoft.Jet.OLEDB.4.0; Data Source =
c:\\excel\mydb.xls; Extended Properties=Excel 8.0;"

Doing this, it accesses the table in sheet1: sql = "select field1 from
data;", but how to access a table located in the same (mydb.xls)  file but
in sheet2?
Thanks
Britt

Author
10 Nov 2006 1:58 PM
Paul Clement
On Thu, 9 Nov 2006 21:56:24 +0100, "Britt" <fbf***@dvsv.qs> wrote:

¤ Hi,
¤
¤ I use this connection string to connect to excel:
¤
¤ ConnectionString="Provider = Microsoft.Jet.OLEDB.4.0; Data Source =
¤ c:\\excel\mydb.xls; Extended Properties=Excel 8.0;"
¤
¤ Doing this, it accesses the table in sheet1: sql = "select field1 from
¤ data;", but how to access a table located in the same (mydb.xls)  file but
¤ in sheet2?

In Excel the Worksheet name is the table name. You simply specify it in your SELECT statement:

SELECT * FROM SHEET2$


Paul
~~~~
Microsoft MVP (Visual Basic)

AddThis Social Bookmark Button