Description
Updates data for one DataWindow, DataWindowChild, or DataStore using the .NET DataStore Web API. Commit changes to the database automatically if succeed, otherwise, roll back the changes automatically.
Applies to
Syntax
objectname.UpdateWithModel(dwControl, urlName {, accept {, resetflag } }{, tokenrequest})
Argument |
Description |
---|---|
objectname |
A reference to the RestClient object. |
dwControl |
The name of the DataWindow control, DataStore, or child DataWindow |
urlName |
A string whose value is the URL of the .NET DataStore Web API. |
accept |
(Optional) A boolean value specifying whether the DataWindow control or DataStore should automatically perform an AcceptText prior to performing the update: True -- (Default) Perform AcceptText. The update is canceled if the data validation fails. False -- Do not perform AcceptText. |
resetflag |
(Optional) A boolean value specifying whether dwcontrol should automatically reset the update flags: True -- (Default) Reset the flags. False -- Do not reset the flags. |
tokenrequest |
(Optional) A reference to the TokenRequest object for supporting OAuth 2.0. If this parameter is used, the token settings in the SetOAuthToken and SetJWTToken functions will be ignored. |
Return value
Integer.
Returns 1 if the function succeeds and a negative value if an error occurs. If any argument's value is null, the method returns null.
Example
The following code example shows updating data for dw_emp using a .NET DataStore Web API:
long ll_return RestClient lnv_RestClient lnv_RestClient = Create RestClient // Update data via .NET DataStore Service ll_return = lnv_RestClient.UpdateWithModel(dw_emp, "http://localhost:5099/UpdateWithModel") // Check the return value if ll_return >= 0 then MessageBox("Success", "Rows = " + String(ll_return)) else MessageBox("Error", "Failed to retrieve data.") end if
See also