[SalesForce] Show Error Arithmetic expressions must use numeric arguments

I have a piece of code that show above error on

     d.FolderId = UserInfo.getUserId();
     d.Name = 'Data2'; 
     String myContent = this.name+ '\n ' +this.pass+ '\n ' + this.age+ '\n ' +this.mail; 
     d.body += Blob.valueof(mycontent);
     d.ContentType = 'text/plain';
     d.Type = 'txt';
     upsert d;
     return null;
 }

 d.body += Blob.valueof(mycontent);(Show error in this line)

Best Answer

Blob just doesn't work that way. You need to build up one string, and call Blob.valueOf at the end. For instance, you could do:

Blob.valueOf(myContent + myContent);

Which seems to be what you want in your example. Or, as an alternative to the code in the flagged duplicate:

Blob.valueOf('s1' + 's2' + 's3');