Generic Data Access

There are several properties on the MM .NET data access classes that help you access data generically regardless of the specific database on the back end. If you use the values in these properties rather than hard-coding data access you can achieve generic data access and switch back ends--even dynamically at run time. Here is a list of these properties:

  • ConcatChar - Character used to concatenate strings. Here is an example showing how to use this property.

    In C#:

    // Get a reference to the data access object
    mmDataAccessBase dao = this.GetDataAccessObject();
    // Build the SQL command using the specified concatenation character(s)
    string Cmd = "SELECT UserID, RTRIM(FirstName) " + dao.ConcatChar + " ' ' " +
    					dao.ConcatChar + " RTRIM(LastName) AS FullName FROM Users";

    And in VB .NET:

    ' Get a reference to the data access object
    Dim dao As mmDataAccessBase = Me.GetDataAccessObject()
    ' Build the SQL command using the specified concatenation character(s)
    Dim Cmd As String = "SELECT UserID RTRIM(FirstName) " + dao.ConcatChar + " ' ' " +
    			dao.ConcatChar + " RTRIM(LastName) AS FullName FROM Users"

  • ParameterPrefixChar - Specifies the character used to prefix parameter names in SQL statements. Here is an example showing how to use this property.

    In C#:

    // Get a reference to the data access object
    mmDataAccessBase dao = this.GetDataAccessObject();
    // Build the SQL command using the specified parameter prefix character
    string Cmd = "SELECT * FROM Roles WHERE RoleID = " + dao.ParameterPrefixChar + "RoleID";

    And in VB .NET:

    ' Get a reference to the data access object
    Dim dao As mmDataAccessBase = Me.GetDataAccessObject()
    ' Build the SQL command using the specified parameter prefix character
    Dim Cmd As String = "SELECT * FROM Roles WHERE RoleID = " + dao.ParameterPrefixChar + "RoleID"
    

  • TableNameDelimitBegin / TableNameDelimitEnd - These two properties specify the beginning and ending characters used to delimit table names. Here is an example showing how to use these properties.

    In C#:

    // Get a reference to the data access object
    mmDataAccessBase dao = this.GetDataAccessObject();
    // Build the SQL command using the specified table name delimit characters
    string Cmd = "SELECT * FROM " + dao.TableNameDelimitBegin + this.TableName + dao.TableNameDelimitEnd;

    And in VB .NET:

    ' Get a reference to the data access object
    Dim dao As mmDataAccessBase = Me.GetDataAccessObject()
    ' Build the SQL command using the specified table name delimit characters
    Dim Cmd As String = "SELECT * FROM " + dao.TableNameDelimitBegin + Me.TableName + dao.TableNameDelimitEnd


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