S
SoAzAppDever
I am using asp.net 2.0. I have an application that gets data from an excel
spreadsheet and displays it in a datagrid. It works as it should. However,
when I deploy this application to the webserver I am required to install MS
Office. I do not want to install MS Office on the web server is there an
alternative method that does not require MS Office to be installed on the web
server?
Below is my code:
string excelConnStr = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" +
path + @"; Extended Properties = ""Excel 12.0 Xml; HDR=YES; IMEX=1;""";
OleDbConnection excelConn = new OleDbConnection(excelConnStr);
OleDbCommand excelCommand = new OleDbCommand();
OleDbDataAdapter excelDataAdapter = new OleDbDataAdapter();
DataSet ds = new DataSet();
System.Data.DataTable dtEmployees = new System.Data.DataTable();
excelCommand = new OleDbCommand("SELECT first, last, begindate,
endate FROM [employees$]", excelConn);
excelDataAdapter.SelectCommand = excelCommand;
excelDataAdapter.Fill(dtEmployeeLeave);
dtEmployees.TableName = "ImportEmps";
ds.Tables.Add(dtEmployees);
spreadsheet and displays it in a datagrid. It works as it should. However,
when I deploy this application to the webserver I am required to install MS
Office. I do not want to install MS Office on the web server is there an
alternative method that does not require MS Office to be installed on the web
server?
Below is my code:
string excelConnStr = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" +
path + @"; Extended Properties = ""Excel 12.0 Xml; HDR=YES; IMEX=1;""";
OleDbConnection excelConn = new OleDbConnection(excelConnStr);
OleDbCommand excelCommand = new OleDbCommand();
OleDbDataAdapter excelDataAdapter = new OleDbDataAdapter();
DataSet ds = new DataSet();
System.Data.DataTable dtEmployees = new System.Data.DataTable();
excelCommand = new OleDbCommand("SELECT first, last, begindate,
endate FROM [employees$]", excelConn);
excelDataAdapter.SelectCommand = excelCommand;
excelDataAdapter.Fill(dtEmployeeLeave);
dtEmployees.TableName = "ImportEmps";
ds.Tables.Add(dtEmployees);