Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

Where 1 = 1 no stringbuilder

$
0
0

Olá

Em meio aos meus estudos encontrei o trecho abaixo:

 

 

 
            StringBuilder sqlString = new StringBuilder();
            sqlString.AppendLine("select * from usuarios");

 

            if (pessoa != null)
            {
                sqlString.AppendLine("Where 1 = 1");
                if (pessoa.Id > 0)
                {
                    sqlString.AppendLine("and id_pessoa = " + pessoa.Id + "");
                }
 
Pra que raios serve o "1 = 1" ?
 
 

Viewing all articles
Browse latest Browse all 14190

Trending Articles