cascade update child table

Posts   
 
    
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 14-Jun-2012 14:50:22   

LLBLGen Runtime LLBlGen 3.5 .Network framework 4.0 C# Windows application SQL Server 2005

Is there a way to update all child tables when a parent table is updated witha value with LLBLGen?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Jun-2012 19:25:50   

Not sure I understand your question. Could you please explain in more details, or maybe post the SQL you want to execute.

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 15-Jun-2012 06:35:20   

Walaa wrote:

Not sure I understand your question. Could you please explain in more details, or maybe post the SQL you want to execute.

Example: I have table country with PK as CountryID and another column called Flag. It has child table State and City with CountryID as FK and colums called Flag.

Now when I update country table with flag=1 related child tables with corresponding FK [countryid] to be updated with flag=1

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 15-Jun-2012 10:17:21   

And how would you do it in SQL? I suppose you would execute to UPDATE statements one for each table.

With LLBLGen if you don't have these entities loaded already, you can use adapter.UpdateEntitiesDirectly() with the appropriate filter.

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 15-Jun-2012 10:18:04   

Walaa wrote:

And how would you do it in SQL? I suppose you would execute to UPDATE statements one for each table.

With LLBLGen if you don't have these entities loaded already, you can use adapter.UpdateEntitiesDirectly() with the appropriate filter.

OK