Data Set do not gets back old reference

28/06/2004 - 22:15 por joyjeet.majumdar | Informe spam
This is a strange case while working with ADO .net in windows
application. If some one can explain me what is going on here or what
i am doing wrong. the story is as below.

I have a Class CData
In this is returm a table view. using a property.

Public ReadOnly Property getPrompt() As DataView
Get
Return Me.tblPrompt.DefaultView
End Get
End Property

I use this in another class Report
I create a seperate instance of dataview and assign it to that object.

Dim PromptDV As New DataView
PromptDV = frmMDI.maintCom.CData.getArrivalsPrompt

Problem 1: If the function in which it contains this abouve piece of
code and is called again though some other place, we still get the old
filtered value.

That is lets print the rowFilter for the PromptDV it will print a
filter criteria. Please see that we have not applied filter to the
Dataview yet

PromptDV.RowFilter = "TYPECODE = 'Cold' "

At this point
frmMDI.maintCom.CData.getArrivalsPrompt.rowfilter will also show the
same value. If we set frmMDI.maintCom.CData.getArrivalsPrompt = "",
then PromptDV.RowFilter also get reset to "".

I am not able to understand this behaviour. Any help of clarification
is highly appreciated.

Regards

-Joyjeet
 

Leer las respuestas

#1 Jose Marcenaro
28/06/2004 - 22:29 | Informe spam
When you assign

Dim PromptDV As New DataView
PromptDV = frmMDI.maintCom.CData.getArrivalsPrompt

you are overwriting the reference to your new DataView with the reference to
the one returned by getArrivalsPrompt, so your new DataView becomes
inaccesible and both references (PromptDV and Me.tblPrompt.DefaultView)
point to the same object

Regards
Jose Marcenaro

NOTE: you'd rather send your messages in english to
microsoft.public.dotnet.ado instead of the spanish newsgroup.

"Joyjeet" escribió en el mensaje
news:
This is a strange case while working with ADO .net in windows
application. If some one can explain me what is going on here or what
i am doing wrong. the story is as below.

I have a Class CData
In this is returm a table view. using a property.

Public ReadOnly Property getPrompt() As DataView
Get
Return Me.tblPrompt.DefaultView
End Get
End Property

I use this in another class Report
I create a seperate instance of dataview and assign it to that object.

Dim PromptDV As New DataView
PromptDV = frmMDI.maintCom.CData.getArrivalsPrompt

Problem 1: If the function in which it contains this abouve piece of
code and is called again though some other place, we still get the old
filtered value.

That is lets print the rowFilter for the PromptDV it will print a
filter criteria. Please see that we have not applied filter to the
Dataview yet

PromptDV.RowFilter = "TYPECODE = 'Cold' "

At this point
frmMDI.maintCom.CData.getArrivalsPrompt.rowfilter will also show the
same value. If we set frmMDI.maintCom.CData.getArrivalsPrompt = "",
then PromptDV.RowFilter also get reset to "".

I am not able to understand this behaviour. Any help of clarification
is highly appreciated.

Regards

-Joyjeet

Preguntas similares