public bool booleano(string procedimiento, SqlParameter[] pparametros)
        {
            try
            {
                objconexion     = Conexion.OpenConexion();
                cmd             = new SqlCommand(procedimiento, objconexion);
                cmd.CommandType = CommandType.StoredProcedure;

                foreach (var parametro in pparametros)
                {
                    cmd.Parameters.Add(parametro).Value = parametro.Value;
                }

                if (cmd.ExecuteNonQuery() == 1)
                {
                    Respueta = true;
                }
                else
                {
                    Respueta = false;
                }


                ConexionDB.CloseConexion(cmd);
            }
            catch (Exception Ext1)
            {
                //System.Windows.Forms.MessageBox.Show(Ext1.Message);

                throw new System.ArgumentException(Ext1.Message, Ext1);
            }

            return(Respueta);
        }
Exemple #2
0
 public bool booleano(string procedimiento, SqlParameter[] pparametros)
 {
     try
     {
         this.objconexion     = Conexion.OpenConexion();
         this.cmd             = new SqlCommand(procedimiento, this.objconexion);
         this.cmd.CommandType = CommandType.StoredProcedure;
         for (int i = 0; i < pparametros.Length; i++)
         {
             SqlParameter sqlParameter = pparametros[i];
             this.cmd.Parameters.Add(sqlParameter).Value = sqlParameter.Value;
         }
         if (this.cmd.ExecuteNonQuery() == 1)
         {
             this.Respueta = true;
         }
         else
         {
             this.Respueta = false;
         }
         ConexionDB.CloseConexion(this.cmd);
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message, ex);
     }
     return(this.Respueta);
 }
        public static DataSet ExistenciaCodigoTabla(string StoreProcedure, SqlParameter[] Parametros)
        {
            SqlConnection objconexion;
            SqlCommand    cmd;

            objconexion     = Conexion.OpenConexion();
            cmd             = new SqlCommand(StoreProcedure, objconexion);
            cmd.CommandType = CommandType.StoredProcedure;
            foreach (var item in Parametros)
            {
                cmd.Parameters.Add(item).Value = item.Value;
            }
            SqlDataAdapter DataAdapter = new SqlDataAdapter(cmd);
            DataSet        DS          = new DataSet();

            DataAdapter.Fill(DS, "Result");

            ConexionDB.CloseConexion(cmd);
            return(DS);
        }
Exemple #4
0
        public List <string> Consultar_Campos(string StoreProcedure, SqlParameter[] Parametros)
        {
            List <string> Lista = new List <string>();

            objconexion     = Conexion.OpenConexion();
            cmd             = new SqlCommand(StoreProcedure, objconexion);
            cmd.CommandType = CommandType.StoredProcedure;

            foreach (var item in Parametros)
            {
                cmd.Parameters.Add(item).Value = item.Value;
            }

            SqlDataReader Reader;

            Reader = cmd.ExecuteReader();
            while (Reader.Read())
            {
                string campo = Reader["NombreCampo"].ToString();
                Lista.Add(campo);
            }
            ConexionDB.CloseConexion(cmd);
            return(Lista);
        }