I have developed my first .NET Widows Form application using VS 2005 C#, Pervasive 10.0 and the 3.0 .NET provider. The application runs fine on my development machine. When I deployed it to another machine (XP, Vista, or Server 2000), I immediately get:
"The type initializer for 'MyApp.Utilities' threw exception."
After some investigation and insertion of MessageBoxes, I determined it was taking place during the "static constructor" for the Utilities class that contained the line:
static PsqlFactory Factory = (PsqlFactory)DbProviderFactories.GetFactory("Perva sive.Data.SqlClient");
I was using
conn = (PsqlConnection)Factory.CreateConnection()
later to create connections. (This is the code in the Pervasive docummentation.)
By eliminating the PsqlFactory and using
conn = new PsqlConnection();
the application is now deployable for testing on other machines.
My questions are:
- Am I loosing any capabilities by not using PsqlFactory?
- Is there another way I should code this to use PsqlFactory?