Hi,
I am using the following code to convert Excel work sheet to datataable. It is working in my local machine from code. But after deployment in Windows 2003 server this is not reading .XlSX files. Also, I have Office 2007 and VSTS 2010 in Windows Server. Any ideas on this please.
{
static System.Data.DataTable lFnConvertWorkSheetToDatatblae(string lStrFileName, string aStrWorkSheetName)string lStrConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + lStrFileName + ";Extended Properties=Excel 8.0;";OleDbConnection lObjConn = null;OleDbDataAdapter lObjSheetAdapter = null;try{
System.Data.
{
lObjConn.Open();
lObjSheetAdapter =
lObjSheetAdapter.Fill(lDTSheetData);
}
}
{
}
DataTable lDTSheetData = new System.Data.DataTable();using (lObjConn = new OleDbConnection(lStrConnectionString))new OleDbDataAdapter("select * from [" + aStrWorkSheetName + "$]", lObjConn);return lDTSheetData;catch (Exception)return null;finally{
{
lObjConn.Close();
lObjSheetAdapter.Dispose();
}
{
lObjConn.Dispose();
}
}
}
if (lObjSheetAdapter != null)if (lObjConn != null)
Prabhu RajaPosted Oct 11, 2011, 4:14 AM
Prabhu RajaPosted Oct 11, 2011, 4:13 AM
I suggest you to try in some other machines except your server and local machine that you already used for this application.
Javeed M ShaikhPosted Oct 11, 2011, 4:10 AM
1. Permission on that file and folder that you are able to create/update in that login account.
2. any other app on that machine is using the same file.
3. If you are using DSN, verify that is not marked to use exclusive to your app.
4. something in IIS, if this is a dev machine and no one is using; try restarting IIS.
Please do not forget to mark "Accepted Answer".
Sreenath GPosted Oct 11, 2011, 3:05 AM
Hi,
I am getting this error at server, but the same works in my local machine.
"The Microsoft Jet database engine cannot open the file ''.
It is already opened exclusively by another user, or you need permission to view its data."
Prabhu RajaPosted Oct 10, 2011, 2:28 AM
Sreenath GPosted Oct 10, 2011, 1:21 AM
Prabhu RajaPosted Oct 8, 2011, 1:14 AM
Check your server config with client Config. i mean if you used some services in local machine for doing this, that services may not be installed in server (for example if you used interop services in local machine, then try to find out that services in server or not). find out or show the error information.
Sam HobbsPosted Oct 7, 2011, 11:31 PM
Javeed M ShaikhPosted Oct 7, 2011, 3:35 PM