Exemple #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pacoteLista"></param>
 /// <param name="vc_Comando"></param>
 private static void adicionaParametrosLista(TransacaoSQL pacoteLista, ref MySqlCommand vc_Comando)
 {
     bool vb_ParametroExiste = false;
     try
     {
         if (pacoteLista.Vlst_Param.Count > 0)
         {
             for (int i = 0; i < pacoteLista.Vlst_Param.Count; i++)
             {
                 vb_ParametroExiste = false;
                 for (int j = 0; j < vc_Comando.Parameters.Count; j++)
                 {
                     if (vc_Comando.Parameters[j].ParameterName.Equals(pacoteLista.Vlst_Param[i].ParameterName)) { vb_ParametroExiste = true; j = vc_Comando.Parameters.Count; }
                 }
                 if (!vb_ParametroExiste)
                 {
                     if (pacoteLista.Vlst_Param[i].Value == null) vc_Comando.Parameters.Add(pacoteLista.Vlst_Param[i].ParameterName, pacoteLista.Vlst_Param[i].SqlDbType).Value = DBNull.Value;
                     else vc_Comando.Parameters.Add(pacoteLista.Vlst_Param[i].ParameterName, pacoteLista.Vlst_Param[i].SqlDbType).Value = pacoteLista.Vlst_Param[i].Value;
                 }
             }
         }
     }
     catch (Exception exc)
     {
         string s = exc.Message;
     }
 }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pacoteLista"></param>
        /// <param name="vc_Comando"></param>
        private static void adicionaParametrosLista(TransacaoSQL pacoteLista, ref MySqlCommand vc_Comando)
        {
            bool vb_ParametroExiste = false;

            try
            {
                if (pacoteLista.Vlst_Param.Count > 0)
                {
                    for (int i = 0; i < pacoteLista.Vlst_Param.Count; i++)
                    {
                        vb_ParametroExiste = false;
                        for (int j = 0; j < vc_Comando.Parameters.Count; j++)
                        {
                            if (vc_Comando.Parameters[j].ParameterName.Equals(pacoteLista.Vlst_Param[i].ParameterName))
                            {
                                vb_ParametroExiste = true; j = vc_Comando.Parameters.Count;
                            }
                        }
                        if (!vb_ParametroExiste)
                        {
                            if (pacoteLista.Vlst_Param[i].Value == null)
                            {
                                vc_Comando.Parameters.Add(pacoteLista.Vlst_Param[i].ParameterName, pacoteLista.Vlst_Param[i].SqlDbType).Value = DBNull.Value;
                            }
                            else
                            {
                                vc_Comando.Parameters.Add(pacoteLista.Vlst_Param[i].ParameterName, pacoteLista.Vlst_Param[i].SqlDbType).Value = pacoteLista.Vlst_Param[i].Value;
                            }
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                string s = exc.Message;
            }
        }