Blob b = Blob.valueOf('Test Data');
    	
Attachment attachment = new Attachment();
attachment.ParentId = parentId;
attachment.Name = 'Test Attachment for Parent';
attachment.Body = b;

insert(attachment);