I did the example twice with two different databases (Adventure works
using MS SQL Server 2005, and an MS Access database).
Although the data sources I used were different than Mr. Sceppa's, the
SQL Server DB (AdventureWorks) wored flawlessly while the trial using
the MS Access database did not. The apparent problem when I tried
using an MS Access database is that the database appears to be empty,
with only a schema (and in fact I know there is at least 80 MB of data
in it).
There are no compile time errors.
At compile time, and design time, I can see almost all of the database
objects in the MS Access database. The only things that seem to be
missing are the relationships among the tables. The tables and views
are all there!
At run time, there are no errors when using the Adventureworks data,
and I can browse through the data one person at a time. When I try to
run the project that uses the MS Access database, I get the following
errors:
A first chance exception of type 'System.InvalidOperationException'
occurred in System.Data.dll
A first chance exception of type 'System.InvalidOperationException'
occurred in System.Data.dll
The thread 0x570 has exited with code 0 (0x0).
The thread 0xe4c has exited with code 0 (0x0).
There is output prior to these messages, but that output contains no
reference to any problem implying the first mention of an exception
shown above is the first occurance of an error.
I do not have MS Access installed, but as I am running Windows XP Pro
(the 64 bit version), jet seems to be present. I am working within the
professional edition of MS Visual Studio 2005, and I have installed MS
SQL Server 2005.
WHY would I have problems getting a C# windows application using
ADO.NET 2 to use an MS Access database while using the same method to
develop the program to use an SQL Server database works just fine?
I find this very odd since I have another application (2 years old),
written in C++ and using ADO/MDAC to work with the very same MS Access
database, and this other application works fine (and this on the same
machine I'm trying to use to develop these programs)!
If it is the case that Jet is basically severely broken, is there an
easy way to move an Access database into SQL Server?
Ted