I would like to know how I can validate that a string
does not duplicate when inserting lines in a text file, since each line contains different information, but until now I only manage to transfer the first line by the number of records that I have stored in DataTable
. I leave the code of what I am doing:
dtH1 = objConsulta.dtMuestraH1();
if (dtH1.Rows.Count > 0)
{
ImportarH1();
string cadena = "";
System.IO.StreamWriter filelocaltxt = new System.IO.StreamWriter("c:\ArchivoPrueba\test.txt");
for (int i = 0; i < dtH1.Rows.Count; i++)
{
cadena = H1IdRgto + "|" + H1Serie + "|3|" + H1FchExp + "|||" + H1FmaPago + "|" + H1CondPago + "|" + H1FnconDoc + "|" + H1TipoDoc + "|" + H1MtvoDesc + "|||||||||||||||||" + H1LugarExp1 + "|" + H1MtdoPago + "|" + H1Moneda + "|" + H1TC + "|||||||||||" + H1ImpLetra + "|" + H1ImprLocal + "|" + H1TipoEnv+ "||||" + H1CodImp+"|||";
filelocaltxt.WriteLine(cadena);
}
filelocaltxt.WriteLine(cadena);
filelocaltxt.Close();
}