System.Data.OleDb.OleDbException (0x80004005): Unspecified error at 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()
Code as Below:
string
strPath =
@"
D:\inetpub\wwwroot\cfxTemp\BuildingScorecardTemplate2014321115842072920729.xlsx"
if
(!File.Exists(strPath))
file.SaveAs(strPath,
true
);
string
strConn =
"
Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
+ strPath +
"
;Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1;FMT=Delimited\""
;
string
worksheetName =
"
"
;
OleDbConnection conn =
new
OleDbConnection(strConn);
conn.Open();
DataTable dtNew;
dtNew = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
null
);
conn.Close();
PLEASE HELP ME.
Please help me.
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.