DeleteDeviceData

Function

Objective

The function is used to delete the data (for example, user information and time segment) on the device.

Parameter description

[in]: The handle that is returned when the connection is successful.

[in]: Data table name. Attached table 4 lists the available data tables.

[in]: Data record; the data is expressed in a text format; the multiple records are separated by \r\n, and the “Field=Value” pairs are separated by \t.

[in]: The default value is null; it is used for extension.

Returned value

When the returned value is 0 or a positive value, it indicates that the operation is successful. When the returned value is a negative value, it indicates that the operation fails. Attached table 5 lists the information about the error codes.

Example

table = “user” data = "Pin=2" # Conditions of deleting the data p_table = create_string_buffer(table) p_data = create_string_buffer(data) ret = self.commpro.DeleteDeviceData(self.hcommpro, p_table, p_data, "")

int ret = 0; string devtablename = "user"; string data = "Pin=2"; string options = ""; ret = DeleteDeviceData(h, devtablename, data, options);

 

Ejemplo

C#

    [DllImport("plcommpro.dll", EntryPoint = "DeleteDeviceData")]
public static extern int DeleteDeviceData(IntPtr h, string tablename, string data, string options);
private void DeleteDeviceData_Pull(string tablename = "user", string data = "1", string options = "")
    {
int ret = 0;
if (IntPtr.Zero != h)
        {
            ret = DeleteDeviceData(h, tablename, data, options);
if (ret >= 0)
                MessageBox.Show("The deleted operation succeed!");
else
                MessageBox.Show("The deleted operation failed!");
        }
    }

VB

<DllImport("plcommpro.dll", EntryPoint := "DeleteDeviceData")> _
Public Shared Function DeleteDeviceData(h As IntPtr, tablename As String, data As String, options As String) As Integer
End Function
Private Sub DeleteDeviceData_Pull(Optional tablename As String = "user", Optional data As String = "1", Optional options As String = "")
Dim ret As Integer = 0
If IntPtr.Zero <> h Then
        ret = DeleteDeviceData(h, tablename, data, options)
If ret >= 0 Then
            MessageBox.Show("The deleted operation succeed!")
Else
            MessageBox.Show("The deleted operation failed!")
End If
End If
End Sub