我正在尝试将设备连接到我的C#.net Windows应用程序。我想连接此设备以从中读取数据并将它们存储到sqlserver数据库中,因此我使用zkemkeeper.dll连接到设备。但是我收到错误。
代码:
if (txtIP.Text.Trim() == "" || txtPort.Text.Trim() == "")
{
MessageBox.Show("IP and Port cannot be null", "Error");
return;
}
int idwErrorCode = 0;
Cursor = Cursors.WaitCursor;
if (button1.Text == "DisConnect")
{
axCZKEM1.Disconnect();
bIsConnected = false;
button1.Text = "Connect";
lblState.Text = "Current State:DisConnected";
Cursor = Cursors.Default;
return;
}
bIsConnected = axCZKEM1.Connect_Net(txtIP.Text, Convert.ToInt32(txtPort.Text));
if (bIsConnected == true)
{
button1.Text = "DisConnect";
button1.Refresh();
lblState.Text = "Current State:Connected";
iMachineNumber = 1;
axCZKEM1.RegEvent(iMachineNumber, 65535);
}
else
{
axCZKEM1.GetLastError(ref idwErrorCode);
MessageBox.Show("Unable to connect the device,ErrorCode=" + idwErrorCode.ToString(), "Error");
}
Cursor = Cursors.Default;
}
}
我在此行收到错误代码0“Data not found or data repeated
”
bIsConnected = axCZKEM1.Connect_Net(txtIP.Text, Convert.ToInt32(txtPort.Text));