Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper way to instantiate a class
Message
From
19/12/2005 10:27:19
 
 
To
19/12/2005 03:56:05
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01079105
Message ID:
01079172
Views:
24
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform