problems connecting to a data source

A

Adam Sandler

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;DefaultDir=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!
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

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.
 
A

Adam Sandler

Göran Andersson said:
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/library/system.web.ui.webcontrols.sqldatasource.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?
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Adam said:
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/library/system.web.ui.webcontrols.sqldatasource.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.
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top