Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 DON'T 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!

  • *Experts*
Posted

I've seen lots of little issues with Expression columns. I'm not sure what the problem is with yours, but I can offer one possible solution. Try clearing the expression column's value (setting the Expression property to string.Empty) before using HasChanges. I've 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 MS's . It's custom code but mimics a DataView that supports columns from different DataTables, through a relationship.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...