时间:2021-07-01 10:21:17 帮助过:5人阅读
private bool ContentSQL() { try { _sqlClient = new TcpClient(); var ar = _sqlClient.BeginConnect("192.168.0.1", 1433, null, null); ar.AsyncWaitHandle.WaitOne(500); return _sqlClient.Connected; } catch (Exception e) { ErrorLog.Add(e.ToString()); MessageBox.Show(e.ToString(),"连接失败",MessageBoxButtons.OK,MessageBoxIcon.Error); return false; } }
服务器IP:192.168.0.1
快速判断SQL数据连接是否正常
标签:null ring handle async send vat ESS nbsp ons