By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,969 Members | 1,522 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,969 IT Pros & Developers. It's quick & easy.

problem with connecting to excel

P: n/a
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
Jun 2 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Bart" <b@swrote in message news:eA**************@TK2MSFTNGP03.phx.gbl...
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:SqlDataSourceto 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
--
http://www.markrae.net

Jun 2 '07 #2

P: n/a
Thank you very much. It works now.
"Mark Rae" <ma**@markNOSPAMrae.netschreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
"Bart" <b@swrote in message
news:eA**************@TK2MSFTNGP03.phx.gbl...
>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:SqlDataSourceto 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
--
http://www.markrae.net

Jun 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.