Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add row to another table from within busines object
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Add row to another table from within busines object
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01359912
Message ID:
01359912
Vues:
133
When certain fields are updated in one table, I want to automatically create a row in a related table if that row does not already exist. I am trying to do that from within the business object for the first table. Everything acts like it's working but the record does not get saved. I am using a HookPostSave override method.

I know when I add rows to a table using mmButtonNew, I have to set the table row to the newly added row by changing the binding context. This is not available from the business object, but I wonder if the problem is similar. I am having trouble figuring out how to fix this. Here's what I have so far. Thanks in advance for any help.
        protected override void HookPostSave(DataTable dt)
        {
            base.HookPostSave(dt);
            this.oLCCDate.GetLCCDateByPatientId(Entity.PatientId);
            if (oLCCDate.DataSet.Tables[0].Rows.Count == 0)
            {
                oLCCDate.NewRow(oLCCDate.DefaultValues);
                //oLCCDate.GetCurrentDataSet();
                oLCCDate.Entity.PatientId = Entity.PatientId;
                oLCCDate.Entity.BegDate = (DateTime)Entity.LCCBegin;
                oLCCDate.Entity.EndDate = (DateTime)Entity.LCCEnd;
                oLCCDate.Entity.EnterBy = mmAppBase.UserMgr.UserID;
                oLCCDate.Entity.LCCMonths = 0;
                oLCCDate.SaveRow();
            }
        }
Linda Harmes
HiBit Technologies, Inc.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform