public int EditarOcorrencia(Ocorrencia o) { string sql = "UPDATE ocorrencia SET status = @status WHERE [codOcorrencia ] = @codOcorrencia;"; int result = 0; SqlConnection conn = new SqlConnection(strConnection); SqlCommand sqlcmd = new SqlCommand(sql, conn); sqlcmd.Parameters.AddWithValue("@status", o.GetStatus()); sqlcmd.Parameters.AddWithValue("@codOcorrencia", o.GetCodOcorrencia()); try { conn.Open(); //verifica se possui algum resultado na consulta result = sqlcmd.ExecuteNonQuery(); } catch (Exception) { throw; } finally { conn.Close(); } return(result); }