DotNet Friends

July 5, 2008

Read Excel using Dotnet application

steps:

1) create simple dotnet application(here i am used C#.net)

2) put the below code

//add namespace
using System.Data.OleDb;
//read Excel File
string FilePath =”c:\test.xls”;
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ FilePath +";Extended Properties=Excel 8.0");
OleDbDataAdapter da = new OleDbDataAdapter("select * from [sheet1$]", con);
DataTable dt = new DataTable();
//get data in datatable
da.Fill(dt);
Thnx
 

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.