Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   GridView to Excel then Excel to database table. (http://www.velocityreviews.com/forums/t549798-gridview-to-excel-then-excel-to-database-table.html)

mohaaron@gmail.com 11-06-2007 06:40 PM

GridView to Excel then Excel to database table.
 
Has anyone else tried to save a GridView as a excel file and then use
ado.net to read the excel sheet back into a database table?

I'm having a terrible time trying to make this work. The normal method
of doing this using OleDb and a connection string like the following
doesn't work on a Excel file that has been created from a GridView.

Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + file + "; Extended
Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";

When doing this ado.net throws the following error.

"External table is not in the expected format."

I did a little research and found that the Excel sheet is in the
format of a html table which this connection string won't work with. I
then found another post where someone was using "Extended
Properties=HTML Import" but when I use this I get a different error.

"The Microsoft Jet database engine could not find the object
'Sheet1$'. Make sure the object exists and that you spell its name
and the path name correctly."

So I'm now stuck and can't make this work. Any idea's would be greatly
appreciated.

Thanks.



All times are GMT. The time now is 08:30 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.