Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper way to instantiate a class
Message
De
19/12/2005 10:27:19
 
 
À
19/12/2005 03:56:05
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01079105
Message ID:
01079172
Vues:
23
My guess is that the SQLExec method is a shared (static) method. Those kinds of methods (and properties) do not require a class to be instantiated. IOW, you would just have:
        If Framework.Data.SQLExec("SELECT Numero,Password,Session FROM " + tcTable + _
         " WHERE Username=""" + lcUsername + """", toConnection) = False Then
~~Bonnie


>I have created a class that I would like to instantiate at various locations in my code. The class name is Data within Framework.dll. The instantiation of the class does not represent a problem. I can compile and have it run ok. But, I have warnings all over the place wherever I am making reference to one of its method. Here is the code:
>
>
>        Dim loDataProvider As Framework.Data = New Framework.Data
>        If loDataProvider.SQLExec("SELECT Numero,Password,Session FROM " + tcTable + _
>         " WHERE Username=""" + lcUsername + """", toConnection) = False Then
>            Framework.App.nLoginSuccess = 4
>            Return False
>        End If
>
>
>Wherever I am making a reference to loDataProvider, such as in the second line in here, I have the message:
>
>Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform