private void button5_Click_1(object sender, EventArgs e) { if (XmlPath != null) { mtypes = Utils.ReadXML(XmlPath); } List <string> id = new List <string>(); foreach (Mtype temp in mtypes) { id = cautaBaza(temp.CpuId); int counterDB = UsefulMethods.getListElements(id); //nr elemete ID db int counterRam = UsefulMethods.getListElements(temp.getRam_param()); string[] idArray; idArray = new string[counterDB]; idArray = UsefulMethods.conversieArray(counterDB, id); string[] ramApl; ramApl = new string[counterRam]; ramApl = UsefulMethods.conversieArray(counterRam, temp.getRam_param()); //idArray, ramApl (array) Console.WriteLine("++++" + temp.CpuNume); if (counterDB >= counterRam) { cmd.Connection = con; con.Open(); for (int i = 0; i < counterRam; i++) { cmd.CommandText = "UPDATE MCU_TYPES SET RAM_PARAM ='" + ramApl[i] + "' WHERE Id ='" + id[i] + "'"; cmd.ExecuteNonQuery(); } con.Close(); } else { cmd.Connection = con; con.Open(); for (int i = 0; i < counterDB; i++) { cmd.CommandText = "UPDATE MCU_TYPES SET RAM_PARAM ='" + ramApl[i] + "'WHERE Id ='" + id[i] + "'"; } cmd.ExecuteNonQuery(); con.Close(); } } }