Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating and Delete Business Objects with Web Forms
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01245632
Message ID:
01246674
Vues:
23
Yassin,

>I am trying to update/Delete Business object in Web forms where my Web form doesn't inherit from mmBusinessWebPage
>
> I have the following piece of code works fine when updating
> Dim oSchoolCategory as New CategoryType
> oSchoolCategory.GetSchoolCategory(Me.BvinField.Value)
> oSchoolCategory.Entity.Facility_Type = Me.txtCategoryType.Text.Trim
> oSchoolCategory.Entity.Facility_Desc = Me.txtCategoryName.Text.Trim
> oSchoolCategory.SaveEntity()
>
> What it means an extra call to the database and then update, is there a way
> just to update by calling an update function and passing primary key value, its the same situation for delete, may be I am missing something.

Since you aren't using MM .NET Web Forms, the binding doesn't happen automatically. What you can do to save a call to the database is store the underlying business object DataSet in a session variable, and then restore the DataSet when you're ready to save. For example:

'' After initially retrieving the data
Session["dsSchoolCategory"] = oSchoolCategory.DataSet

'' When saving
Dim oSchoolCategory as New CategoryType
oSchoolCategory.DataSet = Session["dsSchoolCategory"]
oSchoolCategory.Entity.SetDataRow(oSchoolCategory.DataRow)
oSchoolCategory.Entity.Facility_Type = Me.txtCategoryType.Text.Trim
oSchoolCategory.Entity.Facility_Desc = Me.txtCategoryName.Text.Trim
oSchoolCategory.SaveEntity()

Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform