problem with connecting to excel from asp.net

B

Bart

Hi,

i'm trying to connect to an excel database ('mytable'). With this code, i
get the error: "Keyword not supported: 'provider'".

When i remove 'Provider =' from the connection string, i get the error:
"Keyword not supported: 'microsoft.jet.oledb.4.0; data source'"

This is the aspx file:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="select * from [mytable]"> </asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server"
DataSourceID="SqlDataSource1"></asp:GridView>

the connectionstring in web.config:

<add name="ConnectionString" connectionString="Provider=
Microsoft.Jet.OLEDB.4.0; Data Source =
c:\aspnet\ls4demotest\app_data\ls4demo.xls; Extended Properties=Excel 8.0;"

providerName="System.Data.SqlClient" />

Thanks for help

Bart
 
M

Mike

Try this and modify the data source
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\foldername\workbookname.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top