Bugs in Expressions particularly involving Relations

J

James

I have an ASP.Net database webapp running on .Net 1.1 and I have
unfortunately built into it a lot of code making use of Relations and
expression-type DataColumns containing .Parent and .Child references.
Now it has got moderately complex I am running into huge problems with
this aspect of the application.

After searching the newsgroups I find there was a problem with updating
or adding data to DataTables containing expression columns referring to
other DataTables via Relations a long time ago. I have found a couple
of KB hotfixes dealing with these problems but apparently they aren't
fully tested so I daren't use the one I have been supplied with because
my hosting company may be unwilling to apply it to their version of the
framework. I find that I get VersionNotFoundExceptions which come and
go quite unpredictably according to whether I do things through the
DefaultView of the table or act directly on the table, and whether I
make changes to the parent table before the child or vice versa.

The last straw has been that I have found adding new rows to a
DataTable has caused two new rows in the DefaultView for each row
added.

Looking more in the newsgroups there are many different kinds of
problems reported with this area of ADO.Net and it appears these
problems are not resolved in .Net 2.0.

It would be nice to know anyone's thoughts and what Microsoft intend to
do about this part of ADO.Net being effectively unusable (in my
opinion).

What would be a very useful replacement for this functionality would be
to provide a type of column that could use client code to generate
values for that column probably via an event handler (something like
OnValueRequested) which would call the client code whenever some other
code needed to know the value of that column on a given row.

It would also be a very good idea if it was widely advertised that this
functionality is not in any way reliable so people writing extensive
projects didn't mistakenly try to make use of it.

In the meantime I am going to have to spend more time (and therefore
money) on this project writing custom code to handle retrieving values
in related rows.

James
 
C

Cor Ligthert [MVP]

James,

Can you state where you are talking about, telling that people as you have
reported bugs does not mean those bugs are in the Microsoft software. They
are mostly in the software of the user and seldom when reported (but they
are as well) in the software from Microsoft (by instance the sort inside
expressions).

Therefore, if you mean that it is a bug in the software from Microsoft, than
tell exactly what it is or better, report it in this link.

http://lab.msdn.microsoft.com/productfeedback/Default.aspx

However for that and for this newsgroup you have to be clear, insinuations;
as your message is full of, harms only developer colleagues at Microsoft.

By instance that there are two rows created in a Defaultview seems for me
real culprit. A defaultview has no rows, it holds a reference to a
datarowview collection, where every datarowview corresponding to the
rowfilter has one and not more than one reference to a datarow.

However, if I am wrong in this, create than a testable sample, what
especially with datasets is mostly very easy to do.

The problem may be for you, that not everything is done with wizards or
works as some of us wish, so you have to build things yourself. This is with
almost everything that is about related datatables and datacolumns build by
an expression.

That is not a bug, it needs knowledge from those who are doing it.

Cor
 
J

James

Dear Cor

FYI I have been programming for 23 years and have written a
Windows.Forms component in C# on commercial release.

Your post would seem to imply you are unaware of these problems in
ADO.Net. I would be interested to know whether you are or not.

James
 
G

Guest

Yes, V1.1 DataTable has some problems with expressions mostly relating to not
updating values when multiple tables and a chain of expressions depending on
expressions in a different table. In V2.0 these issues should be fixed, with
the only one I'm aware of is a DataView with a RowFilter having an aggregrate
expression depending on columns with expressions not getting updated when
values change (workaround is to call DataTable.AcceptChanges twice).

By default, the DefaultView.RowStateFilter is DataViewRowState.CurrentRows
which is all the rows in the DataTable except those in the deleted state.

If you have an expression using aggregates (sum, count, ...), when you add a
row to a DataTable, multiple rows can correctly appear or disappear from the
DataView. My favorite RowFilter for this something like "c1%2 =
count(c1)%2", so when you add/remove a row it completely changes the contents
of the DataView.

You can use the DataTable.ColumnChanged or DataTable.RowChanged to manually
maintain computed values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top