ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem with connecting to excel from asp.net (https://www.excelbanter.com/excel-programming/390572-problem-connecting-excel-asp-net.html)

Bart[_7_]

problem with connecting to excel from asp.net
 
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



Mike

problem with connecting to excel from asp.net
 
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"""


"Bart" wrote:

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





All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com