Protected customer As Customer2. Instantiates the Customer business objects.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' Instantiate the Customer object Me.customer = CType(Me.RegisterBizObj(New Customer), Customer) ' '3. In Page_Load Use NewRow() function to add new record and store the business object's DataSet into session.
If Page.IsPostBack Then ' Retrieve the previous Customer DataSet Me.customer.DataSet = Session("dsCustomer") Else ' Add new record Me.oVxlve.NewRow() Session("dsCustomer") = Me.customer.DataSet End If4. When save button clicked, retreive back DataSet from session. Then use Save() function to save the record into database.
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click Dim dsCustomer As DataSet = CType(Session("dsCustomer"), DataSet) Dim result As mmSaveDataResult result = Me.Save(Me.customer, dsCustomer, Me.customer.TableName) Select Case result Case mmSaveDataResult.RulesPassed MsgBox("Record Saved.") Case mmSaveDataResult.RulesBroken MsgBox(Me.customer.Rules.GetAllBrokenRules) Case mmSaveDataResult.RuleWarnings MsgBox(Me.customer.Rules.GetAllWarnings) End Select End SubPlease correct me if I did something wrong. Thanks.