When trying to set the 'max server memory' of a database I use the stored procedure (SP_COFIGURE) as follows:
_bstr_t bstrCommandText = OLESTR("SP_CONFIGURE 'max server memory',");
bstrCommandText = bstrCommandText + bstrServerMemory; // where bstrServerMemory = {"128" (1)}...