Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
685
hierarchy grid update-add-delete
posted

 

I keep getting Sql.Client.SqlException  Insert statement conflicted withy FOREIGN KEY constrainst ........

But I have broken it all up 

level 1   add ; level2 add ; level3 add

level1 modified ; level2 modified ; level3 modified

level3 delete ; level2 delete ; level1 delete

using statements like

iret = this.Level1UpdateQryTableAdapter.Update(clientTreeData.Level1.Select("", "", DataViewRowState.Added));

I have tried doing slightly different  e.g.

this.clientTreeData.Level1UpdateQry.Clear();

this.clientTreeData.Level1UpdateQry.Merge(this.clientTreeData.Level1);

iret = this.Level1UpdateQryTableAdapter.Update(clientTreeData.Level1UpdateQry.Select("", "", DataViewRowState.Added));

 

I am wondering if I ought to preserve rows early on into arrays to later put into tables - but why?  e.g.

DataRow[ drarrayA = clientTreeData.Level1UpdateQry.Select("", "", DataViewRowState.Added );

And I am flushing out before each update  e.g.

this.clientTreeData.Level1UpdateQry.Clear();

 

So what is the trick , how do you ADD , MODIFY and DELETE three tables with a relationship?

I need the relationship in the XSD , so the grid is drilldown. There is little option to change enforcement rules, that I can see.

 

I can supply an example against Northwind, perhaps that is the best way to go. ???

 

  • 469350
    Offline posted

    Hi,

    I'm having a hard time understanding the issue. This does not appear to be related to the Infragistics controls, it looks like you are hacing trouble writing changes from a DataSet back to the database. The grid never deals with the database, only the local data source. So you might have more luck posting on a Microsoft or more general DotNet forum.