How do I set a connection string config programmatically in .net?

I'd like to set a connection string programmatically, with absolutely no change to any config files / registry keys. I have this piece of code, but unfortunately it throws an exception with "the