public bool RegistroExiste(string nomeTabela, string nomeColuna = null, object valor = null, string nomeColuna2 = null, object valor2 = null, string nomeColuna3 = null, object valor3 = null) { try { bool existe = false; Query("Select Count(*) as Existe From ", true); Query(nomeTabela); if (!G1.Nada(nomeColuna) && !G1.Nada(Convert.ToString(valor))) { Param("@v", valor); Query($" Where {nomeColuna} = @v "); if (!G1.Nada(nomeColuna2) && !G1.Nada(Convert.ToString(valor2))) { Param("@v2", valor2); Query($" And {(nomeColuna2)} = @v2 "); if (!G1.Nada(nomeColuna3) && !G1.Nada(Convert.ToString(valor3))) { Param("@v3", valor3); Query($" And {nomeColuna3} = @v3"); } } } Cmd.CommandText = Convert.ToString(query); SqlDataReader dr = Cmd.ExecuteReader(); if (dr.Read()) { existe = G1.GetBool(dr["Existe"]); } dr.Close(); dr.Dispose(); Cmd.CommandText = null; query.Clear(); return(existe); } catch (Exception e) { throw e; } }