Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with column expressions - help!

0 views
Skip to first unread message

Brian Chapman

unread,
Mar 28, 2002, 10:24:15 AM3/28/02
to
I have a typed dataset table with 2 parent tables (the table in
question is the association table from a many to many relationship).
I created a new column in the association table that should be equal
to Parent1.FieldName...so to access that data i'm using
Column.Expression with the following syntax:

Parent(Parent1RelationshipToChild).ParentFieldName

and here's what I get when I try to call new on the dataset:

Object reference not set to an instance of an object.
at System.Data.LookupNode.Bind(DataTable table, ArrayList list)
at System.Data.DataExpression.Bind(DataTable table)
at System.Data.DataExpression..ctor(String expression, DataTable
table, Type type)
at System.Data.DataColumn.set_Expression(String value)
at ECBSqlServices.BusinessService_BusinessRequirementDataTable.InitClass()
at ECBSqlServices.BusinessService_BusinessRequirementDataTable..ctor()
at ECBSqlServices.ECBlueprint.InitClass()
at ECBSqlServices.ECBlueprint..ctor()
at ECDataLibraryTester.Form1.btnLoad_Click(Object sender, EventArgs
e)

any ideas? or help?

Thanks, Brian

Brian Chapman

unread,
Mar 28, 2002, 3:22:31 PM3/28/02
to
Just a follow up, I found the information I needed on some other
groups. The problem is caused by a bug in the dataset class that
Microsoft intends to fix in the first VS.NET service pack, date is not
known. The work around i'm using is just create the additional
columns programatically at run time.

Brian

ripcu...@yahoo.com (Brian Chapman) wrote in message news:<2ea64ade.02032...@posting.google.com>...

Andy Baron

unread,
Mar 28, 2002, 4:40:56 PM3/28/02
to
Thanks for posting the followup. Do you have a pointer to more details
on this bug? I know that using Parent does sometimes work in
expressions. Any info on exactly when it doesn't is appreciated.

-- Andy

In message <2ea64ade.02032...@posting.google.com> Brian

Sadig

unread,
Mar 29, 2002, 8:08:08 AM3/29/02
to
Hi
I also remember that, one or two times I could get the expression with
"Parent" to work without any workaround. But cant do the same now :)
As far as I see the problem's source is only the dataset generator. In the
generated code for the dataset the constructor first tries to create tables,
then add the datarelation. And the constructor for a child table tries to
add the column expression which refers to a nonexistent datarelation.
Neither you can place creation code for the datarelation before the creation
of tables because the datarelation needs the columns of those tables to be
already created. So there is a deadlock. This is in beta 2. But I beleive
the source for the problem in the final is the same.


"Andy Baron" <Andy_...@msn.com> wrote in message
news:ta37au8rks509t2r0...@4ax.com...

Brian Chapman

unread,
Mar 29, 2002, 10:14:57 AM3/29/02
to
You are correct about the generated dataset classes creating the
problem. The problem does still exist in the final release, but
supposedly it will be fixed in SP1 for VS.NET...but no one knows when
that will be released. At this point, I've just moved the creation of
all the expression columns into a separate method in the code, and I'll
make changes when the problem is fixed or I can figure out a better way
to do it.

Thanks for all the input. Brian

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

_alt.0

Andy Baron

unread,
Mar 29, 2002, 10:53:00 AM3/29/02
to
I do know that it is generally recommended to create the expression
*after* populating the DataSet with data.

-- Andy

Sadig

unread,
Mar 29, 2002, 11:44:27 AM3/29/02
to
Then there should be a way to tell the dataset or table to recalculate its
expression columns when needed. Otherwise you have to reassign the
expression string (to get the calculaton logic triggered) everytime you
change data merge/refill etc.
Any ideas

"Andy Baron" <Andy_...@msn.com> wrote in message

news:dc39au8knq0pi661b...@4ax.com...

Andy Baron

unread,
Mar 29, 2002, 2:21:13 PM3/29/02
to
Microsoft has acknowledged that there is a problem with the
updatability of tables that include such expressions. For now, I think
we may need to live with them as read-only or create our own kludgey
workarounds that hopefully will soon become unnecessary.

-- Andy

0 new messages