I wanted to know that can I have 2 or more web.config files in my web project? If yes then how the compiler will check the connection string?
Yes you can have two web.config files in application. There are situations where your application is divided in to modules and for every module you need separate configuration.

For example if you have a application which has two modules lets say accounts and sales. You will create both these modules in a separate folder with each folder having separate config files.
Please do watch this facebook video which explains the same in a very demonstrative manner. Click here to watch , why do we need 2 web.config files in a application