1
Good Afternoon, You Guys
I have the routine below. I would need to streamline this routine it takes a long time to process, someone would tell me how I could do it ?
The Select performed in the dsParam Dataset can bring more than 1 line.
DataTable dtEndereco = new DataTable();
foreach (DataRow drEnd in dsParam.Tables["Endereco"].Select(string.Format("ID = {0} AND Documento = '{1}'", drNotas["ID"].ToString(), Documento)))
{
dtEndereco.ImportRow(drEnd);
dtEndereco.Rows[l]["ID"] = int.Parse(ID_Ini) * -1;
dtEndereco.Rows[l]["Documento"] = Documento_Ini;
l++;
}
Hello Mark, your query returns how many records?
– Carlos H
Have you analyzed if what it takes to generate Datatable or foreach? If this is the query you will need more details of the database and the database that generates Datatable.
– George Wurthmann
It’s Foreach, I ran that analysis
– Marcos muekita
@Marcosmuekita, so your poblema is in the
DataSet
dsParam. But to help you will need more information.– George Wurthmann
What information do you need? The solution that Carlos gave me did not resolve the slowness. If anyone can help me thank you
– Marcos muekita