Search code examples
c#databasewpfvisual-studio

errors with the OleDB namespace in autogenerated dataset.designer.cs files


Anyone else seen these errors with the OleDB namespace in autogenerated dataset.designer.cs files?

So far the consensus tells me that the namespace System.Data.OleDb should contain the OleDbDataAdapter, OleDbConnection, OleDbTransaction, etc.. types. The odd one out though is VS, which states they are not..

I am trying to read/write to a accdb file, made the new dataset file, dropped the tables from my accdb Data Connection on the dataset view, I have all the records and fields available in my codebehind, but the dataset has 250 errrors all like the following↓ from the generated classes in the lower portion of the 'DataSetx'.designer.cs file it nested inside the DataSetx.xsd file... The errors are all the same, just with the relative OleDbData'x' type being the only difference.

[global::System.ComponentModel.DesignerCategoryAttribute("code")]
    [global::System.ComponentModel.ToolboxItem(true)]
    [global::System.ComponentModel.DataObjectAttribute(true)]
    [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
        ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
    [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
    public partial class MyTableAdapter : global::System.ComponentModel.Component
    {

        System.Data.OleDb.OleDbDataAdapter _adapter;

        private global::System.Data.OleDb.OleDbConnection _connection;

        private global::System.Data.OleDb.OleDbTransaction _transaction;

        private global::System.Data.OleDb.OleDbCommand[] _commandCollection;

every instance of OleDbX throws an error similar to:

Severity Code Description Project File Line Suppression State 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. why? how to fix?


Solution

  • running the following command in the package manager console immediately resolved the errors: NuGet\Install-Package System.Data.OleDb -Version 7.0.0

    Apparently it(the OleDb package) is no longer a default installation in Visual Studio. At least not the entirety of it as there was a System.Data.OleDb namespace prior to installing the NuGet package but it had next to no content...