BatchUpdate

Definition

Usage

Start uploading data in batches. Generally, this function is used only after BeginBatchUpdate is used to upload related data.

Parameter

Device number

Return Value

Return True if it is successful, or return False.

Related Function

BeginBatchUpdate, CancelBatchUpdate

 

Ejemplo

C#

private int batchUpdate(string ipAddr, int port)
        {
int iMachineNumber = 1;
int iUpdateFlag = 1;
int idwErrorCode = 0;
//Create Standalone SDK class dynamicly.
            zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
if (axCZKEM1.Connect_Net(ipAddr, 4370))
            {
                axCZKEM1.EnableDevice(iMachineNumber, false);
if (axCZKEM1.BeginBatchUpdate(iMachineNumber, iUpdateFlag))//create memory space for batching data
                {
//perform batch operations (multiple axCZKEM1.SSR_SetUserInfo,  axCZKEM1.SetUserTmpExStr)
                    
                }
                axCZKEM1.BatchUpdate(iMachineNumber);//upload all the information in the memory
                axCZKEM1.RefreshData(iMachineNumber);//the data in the device should be refreshed
                axCZKEM1.EnableDevice(iMachineNumber, true);
                MessageBox.Show("Operation Success!");
            }
else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
            }
            axCZKEM1.Disconnect();
return idwErrorCode;
        }

VB

Private Sub batchUpdate(ipAddr As String, port As Int32)
'Create Standalone SDK class dynamicly.
Dim axCZKEM1 As New zkemkeeper.CZKEM
Dim iMachineNumber As Integer
Dim idwErrorCode As Integer
Dim iUpdateFlag As Integer = 1
If axCZKEM1.Connect_Net(ipAddr, port) = True Then
            axCZKEM1.EnableDevice(iMachineNumber, False)
If axCZKEM1.BeginBatchUpdate(iMachineNumber, iUpdateFlag) Then 'create memory space for batching data
'perform batch operations (multiple axCZKEM1.SSR_SetUserInfo,  axCZKEM1.SetUserTmpExStr)
End If
            axCZKEM1.BatchUpdate(iMachineNumber) 'upload all the information in the memory
            axCZKEM1.RefreshData(iMachineNumber) 'the data in the device should be refreshed
            axCZKEM1.EnableDevice(iMachineNumber, True)
            MsgBox("Operation Success!")
Else
            axCZKEM1.GetLastError(idwErrorCode)
End If
        axCZKEM1.Disconnect()
End Sub