Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
while uploadiing the excel file ,
System.Data.OleDb.OleDbException: Unspecified errorat System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OleDb.OleDbConnection.Open() at clsOledbClass.opencon()
Posted
Updated 29-Apr-13 21:13pm
v3

Your connectionstring is not correct. Check the connectionstring used to read excel file.

Send the code used to upload execl file.
 
Share this answer
 
Comments
avinashangel 30-Apr-13 3:15am    
same code is working on last 1 year ,
flupload.PostedFile.SaveAs(targetFileName + StrFileName);
string StrexcelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + targetFileName + StrFileName + ";Extended Properties='Excel 4.0;HDR=YES;'";
OleDbConnection xlsConn = new OleDbConnection(StrexcelConnectionString);
xlsConn.Open(); // here i got an error
vikas2020 19-Dec-13 2:20am    
Hi Avinash, have u got the solution?
VipulAgrawal 30-Apr-13 3:50am    
If it is not allowing to open connection.....definetly it is a connectionstring issue.....
vikas2020 19-Dec-13 2:22am    
If yes then please share with me, I am also facing the same problem. It works for sometimes and suddenly it starts throwing the exception. In my opinion, it may be because of memory leak. If you have solved the issue then please share with me. Thanks in advance.
avinashangel 30-Apr-13 4:21am    
but same code is running from last 1 year ...
Hi,

Solution:

This issue can be solved by putting <identity impersonate="false"/> in Configuration file.


Description:

Wehn .net reads an excel file, it creats a temp folder to store the data, and that temp folder can only be access by the ASPNET account. so if you impersonate as another user on the computer / network and tried to use ASPNET to read the data in the excel file, you will not be able to.
 
Share this answer
 
ur connection string is wrong there is two connection string for xls and xlsx check online,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900