Exemple #1
0
        //METODO BUSCAR

        public DataTable Buscar(DacfSPNt_Supranumero acfSPNt_Supranumero)
        {
            DataTable     DtResultado = new DataTable("acfSPNt_Supranumero");
            SqlConnection SqlCon      = new SqlConnection();


            try {
                SqlCon.ConnectionString = DConexion.CnBDActivo;
                SqlCommand SqlCmd = new SqlCommand();
                SqlCmd.Connection  = SqlCon;
                SqlCmd.CommandText = "usp_B_acfSPNt_Supranumero";
                SqlCmd.CommandType = CommandType.StoredProcedure;



                SqlParameter ParV_T087U_ANLUE_TXT = new SqlParameter();
                ParV_T087U_ANLUE_TXT.ParameterName = "@sV_T087U_ANLUE";
                ParV_T087U_ANLUE_TXT.SqlDbType     = SqlDbType.VarChar;
                ParV_T087U_ANLUE_TXT.Size          = 12;
                ParV_T087U_ANLUE_TXT.Value         = acfSPNt_Supranumero.V_T087U_ANLUE;
                SqlCmd.Parameters.Add(ParV_T087U_ANLUE_TXT);

                SqlDataAdapter SqlDat = new SqlDataAdapter(SqlCmd);
                SqlDat.Fill(DtResultado);
            }
            catch (Exception ex)
            {
                DtResultado = null;
            }
            return(DtResultado);
        }
Exemple #2
0
        //METODO EDITAR
        public string Editar(DacfSPNt_Supranumero acfSPNt_Supranumero)
        {
            string        rpta   = "";
            SqlConnection SqlCon = new SqlConnection();

            try
            {
                //Código
                SqlCon.ConnectionString = DConexion.CnBDActivo;
                SqlCon.Open();
                //Establecer el Comando
                SqlCommand SqlCmd = new SqlCommand();
                SqlCmd.Connection  = SqlCon;
                SqlCmd.CommandText = "usp_U_acfSPNt_Supranumero";
                SqlCmd.CommandType = CommandType.StoredProcedure;

                SqlParameter ParV_T087U_ANLUE = new SqlParameter();
                ParV_T087U_ANLUE.ParameterName = "@sV_T087U_ANLUE";
                ParV_T087U_ANLUE.SqlDbType     = SqlDbType.Char;
                ParV_T087U_ANLUE.Value         = acfSPNt_Supranumero.V_T087U_ANLUE;
                SqlCmd.Parameters.Add(ParV_T087U_ANLUE);
                //
                SqlParameter ParsV_T087U_ANLUE_TXT = new SqlParameter();
                ParsV_T087U_ANLUE_TXT.ParameterName = "@sV_T087U_ANLUE_TXT";
                ParsV_T087U_ANLUE_TXT.SqlDbType     = SqlDbType.VarChar;
                ParsV_T087U_ANLUE_TXT.Value         = acfSPNt_Supranumero.V_T087U_ANLUE_TXT;
                SqlCmd.Parameters.Add(ParsV_T087U_ANLUE_TXT);
                //

                //Ejecutamos nuestro comando

                rpta = SqlCmd.ExecuteNonQuery() != 0 ? "OK" : "NO se Actualizo el Registro";
            }
            catch (Exception ex)
            {
                rpta = ex.Message;
            }
            finally
            {
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
            }
            return(rpta);
        }