A tale of Two Tables?????

tonyroach1971

New member
Joined
Jun 9, 2003
Messages
2
Location
Chichester, UK
Hi Guys/Girls,
Has anyone come across this problem before EVERYTHING works fine until I update the SQL Server 2000 Database using
a stored procedure.....>

What I have done is created a child reletaionship between two datatables ->tblInvestments and tblInvestmentTypes using the field InvTypeID.

Now, what I have done is added another field to the first datatable(tblInvestments) named Description, and used a expression to show the description field from the second datatable. This works fine.

Now, the problem I have is when I attemp to get the changes in the datatable:

-------------------------------------------------------------

dim tblAdded as datatable

tblAdded = tblInvestments.getchanges(DataRowState.Added)

...........rest of code here........................

this causes an exception ->"Object reference not set to an instance of an object."

BUT the WEIRD part is if i DONT add the description field to the datatable tblInvestments, this code works 100%?????????????very confused!



============================================================================================================================
I have two datatables with the following table structure:

First table:

tblInvestments:
---------------
InvestmentID
AccountCode
CompID
InvTypeID


Second Table:

tblInvestmentTypes
InvTypeID
Description

So, basically the second table(tblInvestmentTypes) is a lookup table. I have created a relationship with the following code:
============================================================================================================================

Any helps would be really great!
 
Ive seen lots of little issues with Expression columns. Im not sure what the problem is with yours, but I can offer one possible solution. Try clearing the expression columns value (setting the Expression property to string.Empty) before using HasChanges. Ive written a function that loops through all columns of all tables in a dataset and saves out the Expression string if it exists. Then I perform my checks (I use an XmlDataDocument and get similar errors with expression columns), then loop back through the DataSet and restore the expression columns.

An alternative would be to use a new object type, such as MSs . Its custom code but mimics a DataView that supports columns from different DataTables, through a relationship.

-Nerseus
 
Back
Top