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

problems connecting to a data source

P: n/a
Hello all,

I'm trying to use VWD 2005 Express Edition to connect to a database.
For my initial prototyping though, I'm just using an Excel
spreadsheet as the source and everything resides on the local host.
All I want to do right now is get the info from the source and display
it on a webpage.

I've dropped a GridView and a SQLDataSource onto the page and
here's the code:

<form id="form1" runat="server">
<div>
<!-- added 5-8-06 -->
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Driver={Microsoft Excel Driver
(*.xls)};DriverId=790;Dbq=C:\Web\test.xls;DefaultD ir=C:\Web;"
SelectCommand="SELECT * FROM [sheet1$]">
</asp:SqlDataSource>

<asp:GridView ID="GridView1" runat="server"
DataSourceID="SqlDataSource1">
</asp:GridView>
</div>
</form>
I've looked at old posts in this group, KB article 311731, and places
like connectionstrings.com. However when I run the app, this error is
thrown:

Server Error in '/WebSite1' Application.

--------------------------------------------------------------------------------

Keyword not supported: 'driver'.
Description: An unhandled exception occurred during the execution
of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported:
'driver'.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
I'm absolutely perplexed by this error... the description says the
keyword "driver" is not supported. Everything I've read shows the
connection string as I tried using it above. I've even copied and
pasted it (only editing the path to the Excel file) from the KB article
and I still get this error. Any suggestions are greatly appreciated.

Thanks!

May 8 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
An SqlDataSource is for use with SQL Server, you can't use it with any
other driver.

Use an OdbcDataSource or OleDbDataSource, depending on what the driver uses.

Adam Sandler wrote:
Hello all,

I'm trying to use VWD 2005 Express Edition to connect to a database.
For my initial prototyping though, I'm just using an Excel
spreadsheet as the source and everything resides on the local host.
All I want to do right now is get the info from the source and display
it on a webpage.

I've dropped a GridView and a SQLDataSource onto the page and
here's the code:

<form id="form1" runat="server">
<div>
<!-- added 5-8-06 -->
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Driver={Microsoft Excel Driver
(*.xls)};DriverId=790;Dbq=C:\Web\test.xls;DefaultD ir=C:\Web;"
SelectCommand="SELECT * FROM [sheet1$]">
</asp:SqlDataSource>

<asp:GridView ID="GridView1" runat="server"
DataSourceID="SqlDataSource1">
</asp:GridView>
</div>
</form>
I've looked at old posts in this group, KB article 311731, and places
like connectionstrings.com. However when I run the app, this error is
thrown:

Server Error in '/WebSite1' Application.

--------------------------------------------------------------------------------

Keyword not supported: 'driver'.
Description: An unhandled exception occurred during the execution
of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported:
'driver'.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
I'm absolutely perplexed by this error... the description says the
keyword "driver" is not supported. Everything I've read shows the
connection string as I tried using it above. I've even copied and
pasted it (only editing the path to the Excel file) from the KB article
and I still get this error. Any suggestions are greatly appreciated.

Thanks!

May 8 '06 #2

P: n/a

Göran Andersson wrote:
An SqlDataSource is for use with SQL Server, you can't use it with any
other driver.

Use an OdbcDataSource or OleDbDataSource, depending on what the driver uses.


Thanks for the reply... I do have a followup question though.
Eventually I will be connecting to Oracle; I was hoping all I'd have to
do with the source change was change the connection string. At any
rate,
http://msdn2.microsoft.com/en-US/lib...atasource.aspx
says I can use a SqlDataSource for any relational database where SQL is
used. So is this a misprint and it should read the SqlDataSource is
for SQL Server only?

May 10 '06 #3

P: n/a
Adam Sandler wrote:
Göran Andersson wrote:
An SqlDataSource is for use with SQL Server, you can't use it with any
other driver.

Use an OdbcDataSource or OleDbDataSource, depending on what the driver uses.


Thanks for the reply... I do have a followup question though.
Eventually I will be connecting to Oracle; I was hoping all I'd have to
do with the source change was change the connection string. At any
rate,
http://msdn2.microsoft.com/en-US/lib...atasource.aspx
says I can use a SqlDataSource for any relational database where SQL is
used. So is this a misprint and it should read the SqlDataSource is
for SQL Server only?


It says that it can be used with any SQL relational database that can be
connected to using an ADO.NET provider.

The Excel driver is not an ADO.NET provider.
May 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.