コード例 #1
0
ファイル: DFabricacion.cs プロジェクト: Net-zar/KPSOFT
        public string Insertar(EFabricacion obj)
        {
            string        rpta = "";
            SqlConnection Con  = new SqlConnection();

            try
            {
                Con = Conexion.getInstancia().CrearConexion();
                SqlCommand cmd = new SqlCommand("TIPO_FABRICACION_INSERTAR", Con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@valor", SqlDbType.VarChar).Value = obj.Fabricacion_Nombre;
                Con.Open();
                rpta = cmd.ExecuteNonQuery() == 1 ? "OK" : "No se pudo insertar el registro";
            }
            catch (Exception ex)
            {
                rpta = ex.Message;
            }
            finally
            {
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
            }
            return(rpta);
        }
コード例 #2
0
        public static string Insertar(string valor)
        {
            DFabricacion Datos = new DFabricacion();
            EFabricacion obj   = new EFabricacion();

            obj.Fabricacion_Nombre = valor;
            return(Datos.Insertar(obj));
        }