private void CheckMsDevices() { string DevicesID; string IPAddress; int Port; int CommKey; Dt = new DataTable(); StrSQL = "select DevicesID, IPAddress, Port, CommKey from MsDevices"; if (cldb.sqlSelectReturnDt(StrSQL, Dt) == 1) { for (int i = 0; i < Dt.Rows.Count; i++) { DevicesID = Convert.ToString(Dt.Rows[i]["DevicesID"]); IPAddress = Convert.ToString(Dt.Rows[i]["IPAddress"]); Port = Convert.ToInt32(Dt.Rows[i]["Port"]); CommKey = Convert.ToInt32(Dt.Rows[i]["CommKey"]); Cursor = Cursors.WaitCursor; axCZKEM1.SetCommPassword(CommKey); bIsConnected = axCZKEM1.Connect_Net(IPAddress, Port); if (bIsConnected == true) { StrSQL = "update MsDevices set Status=1, EditBy='" + MasterForm.UserName + "', EditDate=GetDate() where DevicesID='" + DevicesID + "'"; cldb.SqlExecuteQuery(StrSQL); axCZKEM1.RegEvent(1, 65535); } else { StrSQL = "update MsDevices set Status=0, EditBy='" + MasterForm.UserName + "', EditDate=GetDate() where DevicesID='" + DevicesID + "'"; cldb.SqlExecuteQuery(StrSQL); } } BindData(); } }
public FrmMsDevices() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; Thread.Sleep(120000); Thread t = new Thread(CheckMsDevices); t.IsBackground = true; t.Start(); }
Thread.Sleep(120000);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)