My code is below, any time I run the unit test (or actual application) for this it just stops executing the test (despite having the code below wrapped in a try catch and a break point in the catch).
The resulting file has a field for Severity and Message, but no other fields. I have seen this run intermittently, however, I cannot seem to get it working again.
//DBF Create Table
var currentLogTime = DateTime.UtcNow.ToString("yyMMddHH");
protected const string FORMAT_CONNECTION_STRING = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=dBASE IV";
var connectionString = String.Format(FORMAT_CONNECTION_STRING, DBFPath);
Connection = new OleDbConnection(connectionString);
Connection.Open();
using (var command = Connection.CreateCommand())
{
command.CommandText =
String.Format(
"CREATE TABLE {0} ([SEVERITY] NUMERIC, [MESSAGE] MEMO, [STACKTRACE] MEMO, [OCCURRED] CHAR(50))",
currentLogTime);
try
{
command.ExecuteNonQuery();
}
catch(Exception ex)
{
}
}
It appears that there is a max path length issue that the OleDB driver encounters upon creating the DBT file for the MEMO fields. Shortening the path corrects the issue.