Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generic data class
Message
De
16/01/2006 01:55:01
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
Generic data class
Divers
Thread ID:
01087043
Message ID:
01087043
Vues:
64
I am in the process of adapting my current data class so it would be generic no matter if I use OleDBDataAdapter or SQLDataAdapter. This is an overview of the code I am looking for:
Imports System.Data.OleDb
Imports System.Data.SqlClient

Public Class Data

    Public oDataAdapter As OleDbDataAdapter
    Public oDataSet As DataSet
    Public oDataView As DataView
    Public cSQL As String
    Public cConnectionString As String
    Public nCount As Integer
    Public oParameters As New Collection

    Public Sub New()
        If Framework.App.nSQLMode = 1 Then
            oDataAdapter = New OleDbDataAdapter
        End If
        If Framework.App.nSQLMode = 2 Then
            oDataAdapter = New SqlDataAdapter
        End If
    End Sub
In this portion of code, I would like to find a way that the New() event would be able to initialize oDataAdapter based on my application Framework.App.nSQLMode property. However, this is not possible cause oDataAdapter is already initialized to a default OleDbDataAdapter. The way it is initialized doesn't matter to me. What I need is the ability to preserve those class properties so they are visible in the created object by the use of the Public definition. But, as I said, we cannot redefine a property which is already defined. What approach can I use to have oDataAdapter to adapt itself as per my Framework.App.nSQLMode property?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform