I trying to read Excel file which is Html type with C# code. I'm getting an 'Unspecified error'.
This is my connection string:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='HTML Import; // c:\1.xls
This is my code:
private string GetTableName(OleDbConnection conn)
{
string tableName = null;
try
{
conn.Open();
var dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (dt == null)
{
log.Error("Table schema is not available.");
return tableName;
}
tableName = dt.Rows[0]["TABLE_NAME"].ToString();
}
catch (Exception e)
{
log.Warn(e);
return null;
}
finally
{
conn.Close();
}
return tableName;
}
I looked all over the Internet and Google and nobody had exactly the same issue.
I would like to understand what is wrong with my code or what does it mean the 'Unspecified Error'?!
Thanks !!!