Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scoping of class property
Message
From
19/12/2005 11:05:15
 
 
To
19/12/2005 04:20:01
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01079106
Message ID:
01079197
Views:
36
Just a guess, based on your other recent posts ... you probably have oDataSet defined as a shared (static) member. This is not going to work this way, as you found out. Since shared members don't require an instance of the class, they are always the same every time they are referenced, since you reference them through the class, not through an instance of the class. You need to remove the shared keyword.

~~Bonnie



>I am having something weird that I am trying to resolve. I have a Web Service which responds to various needs. Two of the methods are querying for some data. They both are instantiating a data provider object. The code is like this:
>
>
>        <WebMethod()> _
>        Public Function GetWebServiceHit(ByVal tnRecord As Integer) As DataSet
>            Dim cData As String
>            Dim loDataProvider As Framework.Data = New Framework.Data
>            cData = Framework.FileFunction.GetIni(Framework.App.cStartupDirectory + "\Main.ini", "System", "Data")
>            CheckLogin()
>            If loDataProvider.SQLExec("SELECT TOP " + tnRecord.ToString + _
>             " WSH.Numero,WSH.AddDate,WSH.Method,WSH.Lap,Member.Prenom,Member.Nom,WSH.IP FROM WSH " + _
>             "INNER JOIN " + cData + _
>             "\Member ON WSH.AddUser=Member.Numero ORDER BY WSH.Numero DESC", App.aConnection(1)) = False Then
>                Throw New System.Exception(Framework.App.cError)
>            End If
>            Return loDataProvider.oDataSet
>        End Function
>
>        <WebMethod()> _
>        Public Function GetHit(ByVal tnRecord As Integer) As DataSet
>            Dim lnEXE As Integer
>            Dim lnCounter As Integer
>            Dim cData As String
>            Dim loDataProvider As Framework.Data = New Framework.Data
>            cData = Framework.FileFunction.GetIni(Framework.App.cStartupDirectory + "\Main.ini", "System", "Data")
>            CheckLogin()
>            If loDataProvider.SQLExec("SELECT TOP " + tnRecord.ToString + _
>             " Hit.Numero,Hit.AddDate,Hit.NoEXE,Hit.NoProcess,Hit.NoSubProc,Hit.IP,Hit.Lap," + _
>             "IIF(ISNULL(Member.Prenom),"""",Member.Prenom) AS Prenom,IIF(ISNULL(Member.Nom),"""",Member.Nom) " + _
>             "AS Nom,Hit.WWC,SPACE(40) AS EXE FROM Hit LEFT JOIN " + cData + _
>             "\Member ON Hit.AddUser=Member.Numero ORDER BY Hit.Numero DESC", App.aConnection(1)) = False Then
>                Throw New System.Exception(Framework.App.cError)
>            End If
>            Return loDataProvider.oDataSet
>        End Function
>
>
>Framework.Data is a class which contains some public properties such as oDataSet. So, in this case, once the loDataProvider.SQLExec() method is done, I have access to loDataProvider.oDataSet for my data. This works well. The problem is when I launch two simultaneous requests to the Web Service calling each of those respective methods. Basically, when I do this, I am never able to obtain a success on both methods. The situation is that the data is mixed up between those two methods. But, it shouldn't be. loDataProvider is private to each method so this should work. Anyone would have an idea why oDataSet is mixed up when two simultaneous calls are done on those methods?
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