public static void InsertMysqlInsuredAutorization() { ConectarEpslog(); string query = "select * from seguros_datosgenerales where flag = '0' and cautocode <> '0000'"; OleDbCommand commandselect = new OleDbCommand(query, Conex); OleDbDataReader reader = commandselect.ExecuteReader(); while (reader.Read()) { if (!CompanyInsuredExists(reader)) { ConnectionMySQL.Connect(); //CAMBIAR EL COMPANY_RUC POR COMPANY_CODE ConnectionMySQL.InsertCompanyInsured(reader.GetValue(24).ToString(), reader.GetValue(23).ToString(), reader.GetString(16), reader.GetString(25)); ConnectionMySQL.Disconnect(); } if (!InsuredExists(reader)) { string clinic_history_code = GetClinicHistoryCode(); ConnectionMySQL.Connect(); ConnectionMySQL.InsertInsuredInsured("5", reader.GetString(24), reader.GetString(0), reader.GetString(32), reader.GetString(1), reader.GetString(35), reader.GetString(6), reader.GetString(7), reader.GetString(8), reader.GetString(9), reader.GetString(10), reader.GetString(11), Helper.GetDate(reader.GetString(12)), reader.GetInt16(13).ToString(), reader.GetString(14).ToString(), Helper.GetDate("19900101"), Helper.GetDate("19900101"), Helper.GetDate("19900101"), reader.GetString(41), "", clinic_history_code); ConnectionMySQL.Disconnect(); } string intern_code = GetInternCode(); ConnectionMySQL.Connect(); ConnectionMySQL.InsertAuthorization(reader.GetString(1), "2", reader.GetString(5), reader.GetString(2), Helper.GetDateTime(reader.GetString(3)), reader.GetString(8), reader.GetString(6), reader.GetString(7), Helper.GetDate(reader.GetString(12)), "99999", intern_code, reader.GetValue(20).ToString()); ConnectionMySQL.Disconnect(); UpdateAfterInsert("seguros_datosgenerales", "cAutoCode", 2, reader); } Desconectar(); }