Form display updates - not commmited to DB

FYI....

The suggestion of jinneman in the post below took care of my issue


http://groups.yahoo.com/neo/groups/vantage/conversations/topics/126717


edvKanbanView.DataView(edvKanbanView.Row).BeginEdit()
edvKanbanView.DataView(edvKanbanView.Row)("LegalNumber") = qtyPerLabel
edvKanbanView.DataView(edvKanbanView.Row).EndEdit()


Enclosing my updates in beginedit() and endedit() now allows me to save the changes displayed on the form.





Hi,

Wondering if I can force a DB record update when fields are updated on a form - but the changes are not being saved to the database?
I'm sure this has been addressed on this forum but I can't find it this afternoon.

Below is the offending code:

Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles btnEpiCustom1.Click
 '// ** Place Event Handling Code Here **
        Dim recSelected As Boolean
        Dim whereClause As String = String.Empty
        Dim dsCustomer As DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"CustomerAdapter", recSelected, True, whereClause)
        Dim edv As EpiDataView = CType(oTrans.EpiDataViews("UD15"), EpiDataView)
        '// If a part is selected...
        if recSelected then
            messagebox.show(dsCustomer.Tables(0).Rows(0)("CustNum"))
            edv.DataView(edv.Row)("Number17") = dsCustomer.Tables(0).Rows(0)("CustNum")
            edv.DataView(edv.Row)("ShortChar18") = dsCustomer.Tables(0).Rows(0)("CustID")
        else
            messagebox.show("No Customer Selected")
        end if
    End Sub
*****
It updates the fields on the open form but will not save them to the DB.

BTW... You might recognize that this is based on the answerbook "How to add a search and populate a text box (dsSearch & Filter)"
The original code in the answerbook does update the database (CustXPart table)
Not sure why my variation isn't.


Thanks

P.S. 

I see in the traces that the original is automatically calling an update while my variation is not..


    <businessObject>Epicor.Mfg.BO.CustXPrt</businessObject>
    <methodName>Update</methodName>


Not sure why though.

Maybe due to different dlls involved or something to do with UD forms/tables?

Automatically saving would be a big assumption on the program's part, it doesn't know you are done making changes, you could have several other buttons/events doing changes and you only want to save when everything is done.

The code you have updates fields on the screen. To make it permanent you need to save it by clicking the save button or add otrans.Upate() to your code.

This is the same process that likely happened with the standard code, a change was made to the screen and then at some point a save was made.

If you exited without saving it might ask you if you want to save if you haven't already  You may need to add a rowmod = "U" and/or a notify event to signal that something changed in the dataview.


Jim Kinneman

Encompass Solutions, Inc.

Hi Jim,


Thanks, and I think I understand what you are saying.

What I don't understand why the system doesn't "know" that there were any changes made.

Confusing to me because the original the Epicor example does see the changes and updates the db - the only differences  are the table name and lookup adapter.

Seems weird...


*** Here is a reference to the code in Epicor examples- this one updates the CustXPrt fields in the db (3692ESC)

Private Sub btnEpiCustom2_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles btnEpiCustom2.Click

'// ** Place Event Handling Code Here **

Dim recSelected As Boolean

Dim whereClause As String = String.Empty

Dim dsUD07 As DataSet =

Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"UD07Adapter", recSelected, True, whereClause)

Dim edvCustXprt As EpiDataView = CType(oTrans.EpiDataViews("CustXPrt"), EpiDataView)

'// If a part is selected...

if recSelected then

messagebox.show("UD07 Key: " & dsUD07.Tables(0).Rows(0)("Key1"))

‘//Fill CustXPrt.Character02  with UD07.Key1edvCustXprt.DataView(edvCustXprt.Row)("Character02") = dsUD07.Tables(0).Rows(0)("Key1")

‘//Fill CustXPrt.Character03  with UD07.Character01

edvCustXprt.DataView(edvCustXprt.Row)("Character03") = dsUD07.Tables(0).Rows(0)("Character01")

 

else

messagebox.show("No UD07 Record Selected")

end if

 

End Sub