示例#1
0
 public static void AgregarCargo(Cargo C)
 {
     if (C != null)
     {
         using (SqlConnection con = new SqlConnection(SqlServer.CADENA_CONEXION))
         {
             con.Open();
             string     textoCmd = "INSERT INTO Cargo (descripcion)VALUES (@descripcion)";
             SqlCommand cmd      = new SqlCommand(textoCmd, con);
             cmd = C.ObtenerParametros(cmd);
             cmd.ExecuteNonQuery();
         }
     }
 }
示例#2
0
        public static void EditarCargo(int index, Cargo C)
        {
            if (C != null)
            {
                using (SqlConnection con = new SqlConnection(SqlServer.CADENA_CONEXION))
                {
                    con.Open();
                    string textoCMD = "UPDATE cargo SET descripcion = @descripcion where id = @id";

                    SqlCommand cmd = new SqlCommand(textoCMD, con);
                    cmd = C.ObtenerParametros(cmd, true);

                    cmd.ExecuteNonQuery();
                }
            }
        }