我正在使用ZKemKeeper.DLL创建一个C#WinForm来从生物识别设备中获取数据。但是当我尝试将我的应用程序连接到设备时,它总是提供错误代码-201
任何想法可能导致什么?我已经阅读了ZKemKeeper.DLL的指南文档,但它没有将-201列为错误代码。任何帮助将非常感激。谢谢。
private void btnConnect_Click(object sender, EventArgs e)
{
try
{
IsConnected = TimeKeeper.Connect_Net(txtIP.Text, 4370);
if (IsConnected == true)
{
MessageBox.Show("Device Connected Successfully.");
}
else
{
TimeKeeper.GetLastError(ref ErrorCode);
MessageBox.Show("Device Not Found. Error Code : " + ErrorCode.ToString(), "Error");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
答案 0 :(得分:-1)
protected void btnConnect_Click(object sender, EventArgs e)
{
try
{
//this.Cursor = Cursors.WaitCursor;
//ShowStatusBar(string.Empty, true);
if (IsDeviceConnected)
{
IsDeviceConnected = false;
//this.Cursor = Cursors.Default;
return;
}
string ipAddress = txtIPAddress.Text.Trim();
string port = txtPort.Text.Trim();
if (ipAddress == string.Empty || port == string.Empty)
throw new Exception("The Device IP Address and Port is mandotory !!");
int portNumber = 4370;
if (!int.TryParse(port, out portNumber))
throw new Exception("Not a valid port number");
bool isValidIpA = UniversalStatic.ValidateIP(ipAddress);
if (!isValidIpA)
throw new Exception("The Device IP is invalid !!");
isValidIpA = UniversalStatic.PingTheDevice(ipAddress);
if (!isValidIpA)
throw new Exception("The device at " + ipAddress + ":" + port + " did not respond!!");
objZkeeper = new ZkemClient(RaiseDeviceEvent);
IsDeviceConnected = objZkeeper.Connect_Net(ipAddress, portNumber);
if (IsDeviceConnected)
{
string deviceInfo = manipulator.FetchDeviceInfo(objZkeeper, int.Parse(txtMachineNumber.Text.Trim()));
//lblDeviceInfo.Text = deviceInfo;
lblMessage.Text = deviceInfo + "is Connected";
}
}
catch (Exception ex)
{
throw(ex);
}
//this.Cursor = Cursors.Default;
}