Using the MM .NET VistaDB Data Access Class

To use the MM .NET VistaDB Data Access class in your applications, do the following:

  1. Right-click your business object project and select Add Reference... from the shortcut menu. In the Add References dialog, select the following assemblies:

    • MM .NET Framework VistaDB
    • VistaDB.Net Provider

  2. Click Select, then click OK.

  3. In the Visual Studio Solution Explorer, double-click your Factory.cs or Factory.vb class.

  4. At the top of the source code file, add a reference to the OakLeaf.MM.Main.Data namespace.

    In C#:

    <add key="Northwind\Connection" value="DataSource=C:\Test\VistaDB5\Data\Northwind.vdb3;Password=12345;" />
    <add key="Northwind\DataAccessClass" value="VistaDB" />

    And in VB .NET:

    Imports OakLeaf.MM.Main.Data
    

  5. Override the CreateDataAccessObject method and return a new instance of your custom data access class.

    For example, in C#:

    public override ImmDataAccessBase CreateDataAccessObject(string dataAccessClassName)
    {
    	if (dataAccessClassName.ToLower() == "vistadb")
    	{
    		return new mmDataAccessVistaDB();
    	}
    	else
    	{
    		return base.CreateDataAccessObject(dataAccessClassName);
    	}
    }

    And in VB .NET:

    Public Overrides Function CreateDataAccessObject(dataAccessClassName As StringAs ImmDataAccessBase
     
    	If dataAccessClassName.ToLower() = "vistadb" Then
    		Return New mmDataAccessVistaDB()
    	Else
    		Return MyBase.CreateDataAccessObject(dataAccessClassName)
    	End If
     
    End Function

  6. In your business object project's app.config and in your application's app.config or web.config file and specify "VistaDB" as your database's data access class. For example:

    <add key="Northwind\Connection" value="DataSource=C:\Test\VistaDB5\Data\Northwind.vdb3;Password=12345;" />
    <add key="Northwind\DataAccessClass" value="VistaDB" />

    Check the VistaDB documentation for information on correctly formatting your connection string.


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/20/18
Comment or report problem with topic