Sahil
Tue Nov 29 07:24:46 CST 2005
Well .. truthfully I'm not trying to sell :) .. I don't represent MS
.. but anyway .. lets consider a simile, when you are working with a
database table, do you rely on default indexing or do you sort and then are
assured of the indexing? I'm guessing it's the latter - so why should
dataviews be any different?
Either way I have raised it to internal MS folks .. maybe they will have a
better answer.
- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
----------------------------------------------------------------------------
"Bob L." <nospam.info2@libertyfamily.net> wrote in message
news:OPVLG9N9FHA.2832@TK2MSFTNGP14.phx.gbl...
>I appreciate the response, but that's a tough sell. The row is valid with
>or
> without the filter, so it should remain the same. Obviously the object is
> being reloaded with whatever is the first element in the list, but it is
> atypical to mess around with an existing object behind the scenes.
>
> The bottom line is that it breaks our application and we need a fix or
> workaround. So to say this was "fixed" in 2.0 doesn't get us to our goal!
>
> - Bob
>
> "Sahil Malik [MVP]" <contactmethrumyblog@nospam.com> wrote in message
> news:uvF8kWJ9FHA.132@TK2MSFTNGP15.phx.gbl...
>> Okay the behavior is inconsistent between 1.1 and 2.0, but truthfully as
> the
>> RowFilter changes, the Dataview should reflect the changes - and since 12
> is
>> the first row, the bug is with .NET 1.1, not 2.0.
>>
>> - Sahil Malik [MVP]
>> ADO.NET 2.0 book -
>>
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
>> --------------------------------------------------------------------------
> --
>>
>> "Bob L." <nospam.info1@libertyfamily.net> wrote in message
>> news:%23FpxUIG9FHA.2816@tk2msftngp13.phx.gbl...
>> > Hi, everyone,
>> >
>> > I ran into a serious bug upgrading to VS2005, and very easy to
> reproduce.
>> > It
>> > goes like this:
>> >
>> > 1. Filter a DataView
>> > 2. Get a reference to a DataRowView
>> > 3. Clear the filter - the reference to the DataRowView has changed to a
>> > completely different row!
>> >
>> > This is not a problem in .NET 1.1 - only in 2.0. The code to reproduce
> the
>> > problem is below. Please help!
>> >
>> > Thanks,
>> > Bob L.
>> >
>> >
>> > Dim oTable As DataTable
>> > Dim oView As DataView
>> > Dim oRowView As DataRowView
>> >
>> > 'Build simple table
>> > oTable = New DataTable
>> > oTable.Columns.Add("ID", GetType(Integer))
>> > oTable.Rows.Add(New Object() {12})
>> > oTable.Rows.Add(New Object() {25})
>> >
>> > 'Construct & filter DataView
>> > oView = New DataView(oTable)
>> > oView.RowFilter = "ID=25"
>> >
>> > 'Get a reference to the found item and display the ID
>> > oRowView = oView.Item(0)
>> > MsgBox(oRowView.Item(0)) 'ID = 25
>> >
>> > oView.RowFilter = ""
>> >
>> > 'Show the same ID again
>> > 'In 1.1 this line of code still shows 25 - correct.
>> > 'In 2.0 it shows 12 - wrong!
>> > MsgBox(oRowView.Item(0))
>> >
>> >
>>
>>
>
>