Re: Nasty DataView bug



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@xxxxxxxxxx> wrote in message
news:uvF8kWJ9FHA.132@xxxxxxxxxxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxxxx> wrote in message
> news:%23FpxUIG9FHA.2816@xxxxxxxxxxxxxxxxxxxxxxx
> > 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))
> >
> >
>
>


.



Relevant Pages

  • Re: Better way? (DataView question)
    ... objConnection) ... Dim ds As New DataSet ... set the filter property on the DataSource which will give you a DataView ... DataView from the table in the dataset. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Better way? (DataView question)
    ... DataSet that's in session memory and create a filter? ... Create DataView from DataSet in session memory ... Dim ds As New DataSet ...
    (microsoft.public.dotnet.framework.aspnet)
  • Nasty DataView bug
    ... Filter a DataView ... Get a reference to a DataRowView ... Dim oTable As DataTable ... Dim oView As DataView ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Better way? (DataView question)
    ... objConnection) ... Dim ds As New DataSet ... set the filter property on the DataSource which will give you a DataView ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Separating 1 workbook into multiple workbooks
    ... It will filter on column A this example ... I assume that your headers are in row 1 so the header "Supervisor" is in A1 ... Dim CalcMode As Long ... 'Name of the sheet with your data ...
    (microsoft.public.excel.misc)

Loading