private void btnPing_Click(object sender, EventArgs e) { PingServiceReference.PingServiceClient client = new PingServiceReference.PingServiceClient(); bool result = client.IsDbUp(txtConnString.Text); lblResult.Text = "Database with connection string " + txtConnString.Text + " is up? " + result; }
private void btnPing_Click(object sender, EventArgs e) { try { PingServiceReference.PingServiceClient client = new PingServiceReference.PingServiceClient(); bool result = client.IsDbUp(txtConnString.Text); lblResult.Text = "Database with connection string " + txtConnString.Text + " is up? " + result; } catch (FaultException <PingServiceReference.PingException> ex) { MessageBox.Show(ex.Detail.Message); } }