OleDbConnection connection = new OleDbConnection();
string path = string.Concat(Server.MapPath("../Uploaded Folder/chart.xls"));
// Excle Read Connection String for open office
string excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + path + "; Extended Properties=Excel 8.0;";
connection.ConnectionString = excelConnectionString;
OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection);
OleDbCommand command2 = new OleDbCommand("select * from [Sheet2$]", connection);
connection.Open();
// Create DbDataReader to Data Worksheet
DbDataReader dr = command.ExecuteReader();
DbDataReader dr2 = command2.ExecuteReader();
dt.Load(dr);
dt1.Load(dr2);
ds = new DataSet();
ds.Tables.Add(dt);
ds.Tables.Add(dt1);
string path = string.Concat(Server.MapPath("../Uploaded Folder/chart.xls"));
// Excle Read Connection String for open office
string excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + path + "; Extended Properties=Excel 8.0;";
connection.ConnectionString = excelConnectionString;
OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection);
OleDbCommand command2 = new OleDbCommand("select * from [Sheet2$]", connection);
connection.Open();
// Create DbDataReader to Data Worksheet
DbDataReader dr = command.ExecuteReader();
DbDataReader dr2 = command2.ExecuteReader();
dt.Load(dr);
dt1.Load(dr2);
ds = new DataSet();
ds.Tables.Add(dt);
ds.Tables.Add(dt1);
No comments:
Post a Comment