I use zkemkeeper class to connect with fingerprint.
I have a method for synchronize user from fingerprint as follow:
private void SynchronizeUser_Clicked(object sender, EventArgs e) {
if (currentMouseOverRow >= 0) {
string Status = Convert.ToString(GVDevices.GetRowCellValue(currentMouseOverRow, "Status"));
if (Status == "Connect") {
axCZKEM1.ReadAllUserID(iMachineNumber);
string sdwEnrollNumber = "";
string sName = "";
string sPassword = "";
int iPrivilege = 0;
bool bEnabled = false;
Dt = new DataTable();
StrSQL = "select * from MsEmployee";
cldb.sqlSelectReturnDt(StrSQL, Dt);
if (Dt.Rows.Count == 0) {
StrSQL = "";
while (axCZKEM1.SSR_GetAllUserInfo(iMachineNumber, out sdwEnrollNumber, out sName, out sPassword, out iPrivilege, out bEnabled)) {
StrSQL += "insert into MsEmployee(EmployeeID, EmployeeName) " + System.Environment.NewLine +
"values(" + sdwEnrollNumber + ", '" + sName + "') " + System.Environment.NewLine;
}
if (cldb.SqlExecuteQuery(StrSQL) == 1) {
clglobal.ShowMessage("Success synchronize user.");
} else {
clglobal.ShowMessage("Fail synchronize user!");
}
} else {
String StrSQLUser = "";
while (axCZKEM1.SSR_GetAllUserInfo(iMachineNumber, out sdwEnrollNumber, out sName, out sPassword, out iPrivilege, out bEnabled)) {
StrSQL = "select * from MsEmployee where EmployeeID = " + sdwEnrollNumber + "";
cldb.sqlSelectReturnDt(StrSQL, Dt);
if (Dt.Rows.Count > 0) {
if (Convert.ToString(Dt.Rows[0]["EmployeeName"]) != sName) {
StrSQLUser += "update MsEmployee set EmployeeName='" + sName + "'" + System.Environment.NewLine +
"where EmployeeID=" + sdwEnrollNumber + "";
}
} else {
StrSQLUser += "insert into MsEmployee(EmployeeID, EmployeeName) " + System.Environment.NewLine +
"values(" + sdwEnrollNumber + ", '" + sName + "') " + System.Environment.NewLine;
}
}
if (cldb.SqlExecuteQuery(StrSQLUser) == 1) {
clglobal.ShowMessage("Success synchronize user.");
} else {
clglobal.ShowMessage("Fail synchronize user!");
}
}
} else {
clglobal.ShowMessage("Please connect the device first!");
return;
}
}
}
But i have an error like this:
I have a error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I've also been browsing and found an article to uncheck
"Surpress JIT optimization on module load(Managed only)"
but i can't debug my sourcecode.
Please help me, why this could happen?
Thanks