Hi rohanp,
Since the web.config file is common for all the subdomains, you can add multiple connection string in the web.config file like below for each sub domain.
<connectionStrings>
<add name ="subdomain1" connectionString="Server=.;DataBase=Test;UID=sa;PWD=sa" providerName="System.Data.SqlClient" />
<add name ="subdomain2" connectionString="Server=.;DataBase=Test;UID=sa;PWD=sa" providerName="System.Data.SqlClient" />
<add name ="subdomain3" connectionString="Server=.;DataBase=Test;UID=sa;PWD=sa" providerName="System.Data.SqlClient" />
</connectionStrings>
Then you can check for the current url using the below code.
string url = HttpContext.Current.Request.Url.AbsoluteUri;
Then retrive the subdomain from the url. Then use the proper connection string as per the subdomain.