GetDeviceDataCount

Definition

Usage

The function is used to read the total number of records on the device and return the number of records for the specified data.

Parameter

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

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

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

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

Return Value

When the returned value is 0 or a positive value, it indicates that the operation is successful

(the returned value indicates the number of records). When the returned value is a negative value,

it indicates that the operation fails. Attached table 5 lists the information about the error codes.

Related Function

GetDeviceData

 

Ejemplo

C#

        
[DllImport("plcommpro.dll", EntryPoint = "GetDeviceDataCount")]
public static extern int GetDeviceDataCount(IntPtr h, string tablename, string filter, string options);
public void GetDeviceDataCount_Pull()
{
	Connect_Pull();
        int ret = 0;
        string devtablename = "user";
        string[] count = new string[20];
        if (IntPtr.Zero != h)
	{
		MessageBox.Show("devtablename=" + devtablename + ",devdatfilter=" + "" + ",options=" + "");
		ret = GetDeviceDataCount(h, devtablename, "", "");
        if (ret >= 0)
			MessageBox.Show("ret=" + ret);
	}
        else
	{
		MessageBox.Show("Connect device failed!");
        return;
	}
	Disconnect_pull();
}

VB

        
<DllImport("plcommpro.dll", EntryPoint:="GetDeviceDataCount")>
Public Shared Function GetDeviceDataCount(h As IntPtr, tablename As String, filter As String, options As String) As Integer
End Function
Public Sub GetDeviceDataCount_Pull()
	Connect_Pull()
        Dim ret As Integer = 0
        Dim devtablename As String = "user"
        Dim count As String() = New String(19) {}
        If IntPtr.Zero <> h Then
		MessageBox.Show((Convert.ToString("devtablename=") & devtablename) + ",devdatfilter=" + "" + ",options=" + "")
		ret = GetDeviceDataCount(h, devtablename, "", "")
        If ret >= 0 Then
			MessageBox.Show("ret=" + ret)
        End If
        Else
		MessageBox.Show("Connect device failed!")
        Return
        End If
	Disconnect_pull()
End Sub