When making a project in WPF C# (.NET 5.0)
, I wanted to use data from my database. I have a Microsoft Access file (2000-2003 compatible version, *.mdb
), which I needed to use for my project.
After I added new source
Add > new Item... > Data > DataSet
and specified properly the database (the connection was tested successful), file DataSetProj.xsd
has been created.
However, when I tried running the code, the following error occurred:
Error CS1069: The type name 'OleDbDataAdapter' could not be found in the namespace 'System.Data.OleDb'. This type has been forwarded to assembly 'System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.
When clicking the CS1069
hyperlink, this site opened (unfortunately, no specifics on the error were provided).
Trying to fix the error myself, I found System.Data.OleDb namespace documentation. Here's my interesting observation: The code automatically generated by DataSetProj.Designer.cs
file had classes (supposedly defined in the namespace), like OleDbConnection
, or OleDbDataAdapter
. Funnily enough, this namespace mentions these classes, but it appears they are not part of the namespace (although this is official MS documentation). When I enter documentation of either of the classes, they are included in the System.Data.Ole.Db
namespace. This is weird and super unclear (at least for me, junior dev) documentation.
I tried switching to .NET 4.8 Framework
, use EF Core Power Tools by ErikEJ
(unfortunately it doesn't work with Access *.mdb
file). I could not find the answer to this problem anywhere, although it seems like many people would have such an issue.
How do I make it work?