Help!!! DataRelation with "Object Reference" Erro

B

Blacktongue

I have three tables of interest in my Dataset:
1. "Assemblies" table: contains assembly ID (primary key) and
information about the assembly.
2. "AssemblyHierarchy" table: contains a listing of the parent-child
relationship between various assemblies. For example, if the
ParentAssemblyID is "A" and the ChildAssemblyID is "B", then "B" is a
subassembly of "A" (similar to child nodes in a tree data structure).
For this table, the primary key is the combination key of
ParentAssemblyID and ChildAssemblyID
3. "AssemblyMaterial" table: contains a listing of material items
for an assembly. Here the primary key is the combination key of
AssemblyID and ItemID.

I have the following two sets of relations set up in the data set.

Two relations between "Assemblies" table and "AssemblyHierarchy"
table:
Assembly.AssemblyID --> AssemblyHierarchy.ParentAssemblyID
Assembly.AssemblyID --> AssemblyHierarchy.ChildAssemblyID

One relation between "Assemblies" table and "AssemblyMaterial" table:
Assembly.AssemblyID --> AssemblyMaterial.AssemlbyID


Here is the problem. I have a master-detail form in which the
"Assemblies" table makes up the master portion (using text boxes and
labels bound to the dataset). The detail portion of the form is two
data grids, one bound to the "AssemblyHierarchy" table by way of the
two DataRelations (shown above) and the other bound to the
"AssemblyMaterial" table by way of the other DataRelation.

Whenever I try to change the "AssemblyID" (primary key) in the master
portion of the form, I get the following error:

"Object reference not set to an instance of an object"

This error actually occurs whenever I try to execute the
EndCurrentEdit() method on the binding context for the "Assemblies"
table.

The error prevents me from changing the primary key of the
"Assemblies" table. However, I want to be able to do this and then
have the new value of the primary key transferred to the related
tables automatically using the data relations that already exists.

Any suggestions. I desperately need help on this one.
 
E

Earl

Someone told me that topics with 3 slammers (!!!) are no longer being
answered. I hear it now takes at least 4 slammers to get noticed ...

Blacktongue said:
I have three tables of interest in my Dataset:
1. "Assemblies" table: contains assembly ID (primary key) and
information about the assembly.
2. "AssemblyHierarchy" table: contains a listing of the parent-child
relationship between various assemblies. For example, if the
ParentAssemblyID is "A" and the ChildAssemblyID is "B", then "B" is a
subassembly of "A" (similar to child nodes in a tree data structure).
For this table, the primary key is the combination key of
ParentAssemblyID and ChildAssemblyID
3. "AssemblyMaterial" table: contains a listing of material items
for an assembly. Here the primary key is the combination key of
AssemblyID and ItemID.

I have the following two sets of relations set up in the data set.

Two relations between "Assemblies" table and "AssemblyHierarchy"
table:
Assembly.AssemblyID --> AssemblyHierarchy.ParentAssemblyID
Assembly.AssemblyID --> AssemblyHierarchy.ChildAssemblyID

One relation between "Assemblies" table and "AssemblyMaterial" table:
Assembly.AssemblyID --> AssemblyMaterial.AssemlbyID


Here is the problem. I have a master-detail form in which the
"Assemblies" table makes up the master portion (using text boxes and
labels bound to the dataset). The detail portion of the form is two
data grids, one bound to the "AssemblyHierarchy" table by way of the
two DataRelations (shown above) and the other bound to the
"AssemblyMaterial" table by way of the other DataRelation.

Whenever I try to change the "AssemblyID" (primary key) in the master
portion of the form, I get the following error:

"Object reference not set to an instance of an object"

This error actually occurs whenever I try to execute the
EndCurrentEdit() method on the binding context for the "Assemblies"
table.

The error prevents me from changing the primary key of the
"Assemblies" table. However, I want to be able to do this and then
have the new value of the primary key transferred to the related
tables automatically using the data relations that already exists.

Any suggestions. I desperately need help on this one.
 

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