problem with connecting to excel

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

Chris
 
M

Mark Rae

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

I believe you need to explicitly tell <asp:SqlDataSource> to use
System.Data.OleDb e.g.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ProviderName="System.Data.OleDb"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="select * from [mytable]" />

http://forums.asp.net/t/979962.aspx
 
B

Bart

Thank you very much. It works now.


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

I believe you need to explicitly tell <asp:SqlDataSource> to use
System.Data.OleDb e.g.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ProviderName="System.Data.OleDb"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="select * from [mytable]" />

http://forums.asp.net/t/979962.aspx
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top