In my project, I have a SELECT
that returns me two names, but those names are different. In my command, I need to return these two different names that are in the same column of the database in an tag of an xml I am creating.
How could I make a method that recognizes these two names in C # and return them?
The way I have it, it returns me only one.
I'll put my SELECT
here to help!
SELECT *
FROM TabelaPessoa
INNER JOIN TabelaRegistro ON PessoaCodCasamentoCodigo = CasamentoCodigo
INNER JOIN LocalCasamento ON LocalCasamentoCodigo = CasamentoCodigo
LEFT JOIN CasamentoRegime ON RegimeCodigo = CasamentoCodigo
LEFT JOIN Infomacao ON InformacaoCodigo = CasamentoCOdigo
WHERE NomePessoa = 'Fulano' OR
NomePessoa = 'Fulana'
AND CodigoTipoPessoa IN (1, 7)
EDIT
Codes C#
I have:
try
{
string sqlPesquisa = "";
sqlPesquisa = "SELECT * \n" +
"FROM TabelaPessoa INNER JOIN TabelaRegistro ON \n" +
" PessoaCodCasamentoCodigo = CasamentoCodigo INNER JOIN LocalCasamento ON \n" +
" LocalCasamentoCodigo = CasamentoCodigo LEFT JOIN CasamentoRegime ON \n" +
" RegimeCodigo = CasamentoCodigo LEFT JOIN Infomacao ON \n" +
" InformacaoCodigo = CasamentoCodigo \n" +
"WHERE NomePessoa = " + tabela + " OR \n" +
" NomePessoa = " + tabela + " AND \n" +
" CodigoTipoPessoa IN (1, 7)";
DataTable pesquisa = executarPesquisa(sqlPesquisa);
return (pesquisa);
}