EssGBeginUpdate

Begins an update of data at the server. This function returns no data to the caller.

Syntax

ESSG_FUNC_M EssGBeginUpdate (hGrid, ulOptions);
ParameterData TypeDescription

hGrid

ESSG_HGRID_T

Handle passed back from EssGNewGrid.

ulOptions

ESSG_ULONG_T

A constant which indicates whether the blocks must be previously locked or not prior to update. One of the following mutually exclusive values must be used:

  • ESSG_REQUIRELOCK If the blocks haven't been previously locked, disallow the update.

  • ESSG_LOCKIFNEEDED If the blocks haven't been previously locked, lock them and allow the update.

Notes

The blocks are unlocked after the operation is complete, when you have called EssGPerformOperation. If you want the blocks to remain locked, set the Update Mode option to TRUE in EssGSetGridOptions. You do not need to retrieve any rows for this operation; it is suffcient to call EssGSendRows and EssGPerformOperation.

Return Value

If successful, returns ESSG_STS_NOERR.

Access

None.

Example

ESSG_VOID_T ESSG_BeginUpdate (ESSG_HGRID_T hGrid)

{
  ESSG_FUNC_M     sts = ESS_STS_NOERR;
  ESSG_PPDATA_T         ppDataIn;
  ESSG_RANGE_T          rDataRangeIn;
  ESSG_ULONG_T          ulOptions;

  /* connect the grid to a database on the server */
  sts = EssGConnect(hGrid, "Rainbow", "Admin", 
        "Password", "Demo", "Basic", ESSG_CONNECT_NODIALOG);
   
  if(sts == 0)
  {
     ppDataIn = BuildTable (&rDataRangeIn); 
      
     ulOptions = ESSG_LOCKIFNEEDED;
     /* start the update operation */
     sts = EssGBeginUpdate(hGrid, ulOptions);
  }

  if(sts == 0)
  {
     /* send the entire grid to define the query */
     sts = EssGSendRows(hGrid, &rDataRangeIn, ppDataIn);
  }

  if(sts == 0)
  {
     /* perform the update */
     sts = EssGPerformOperation(hGrid, 0);

     /* free the built data */
     FreeTwoDim(ppDataIn, rDataRangeIn.ulNumRows);
  }
   
  if(!sts)
  {
  EssGEndOperation(hGrid, 0);
  EssGDisconnect(hGrid, 0);
  }
}

See Also