I have created two functions that encrypt and decrypt the connection string in web.config. But whenever I want to use connection string. I have to always decrypt web.config and then again encrypt it back. Does there any other way which i can use.

You can set things up so that the configuration section provider does the decryption for you. See this article.

Obviously, you (as the developer) need to do the initial work to encrypt the data and put it into the .config in the first place.

And, of course, if you've got a farm then each machine will by default have its own machine key for encrypt/decrypt, which would necessitate separately encrypted .config files for each machine, and that's no good. You'll need to set a different key, as described here.