I had the same problem. You can do something like this.
This is for MFC.
CString sAttributes;
sAttributes += "DSN=";
sAttributes += YOUR DSN NAME;
sAttributes += '\0';
sAttributes += "Server=";
sAttributes += SERVER NAME;
sAttributes += '\0';
You can do the same for extra attributes.