1
As darlings in my C# Winforms project are being carried out through StringBuilder
. It was suggested here in the O.R. query of Consulta.Append("Select * from...")
for @"select * from..."
for being somewhat redundant. Below is a fragment of the code after the change:
string Consulta = @"select nome as Nome,
endereco as Endereço,
telefone as Telefone,
dataCadastro as [Data de Cadastro]
From clientes
where dataCadastro='"+ Convert.toString(dePeriodo.Text) +"'
and status<>0";
foreach (DataRow iRow in Dados.SQLData.dsData(Consulta).Tables[0].Rows)
{
//restante aqui
}
It turns out that when using the reported method it is not possible to concatenate the component parameter DateEdit (dePeriodo)
because the double quotes that are in ...dataCadastro='"+ dePeriodo...
, which opens the concatenation, is actually closing the query. How should I proceed to concatenate the value of the component with a query without causing this error?
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer.
– Maniero