Nisha
Nisha

Reputation:

ASP.NET with SQL

How do I display, edit and save an Excel sheet data in sql server?

Any help would be appreciated.

Upvotes: 0

Views: 107

Answers (2)

Deepak
Deepak

Reputation: 7907

You can use this connection string for excel 2003:

con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
                filePath + ";Extended Properties=Excel 8.0");

and for Excel 2007, you can use this connection string:

con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                filePath + ";Excel 12.0;HDR=YES");

After if you can execute direct query for excel sheet. You can also take the reference of "Microsoft.Office.Interop.Excel.dll" DLL and use it.

Upvotes: 1

Kirtan
Kirtan

Reputation: 21695

You can use the Microsoft.ACE.OLEDB provider to connect to an Excel sheet using an OLEDB connection. You can then query the Excel sheet directly like you would do a database.

Upvotes: 1

Related Questions