web.config
<connectionStrings>
<add name="ConnectionString1" connectionString="Data Source=MUTHU-PC\SQLEXPRESS;Initial Catalog=yourFirstDataBaseName;Integrated Security=False;User ID=sa5556;Password=5555" providerName="System.Data.SqlClient" />
<add name="ConnectionString2" connectionString="Data Source=MUTHU-PC\SQLEXPRESS;Initial Catalog=yourSecondDataBaseName;Integrated Security=False;User ID=sa5556;Password=5555" providerName="System.Data.SqlClient" />
</connectionStrings>
in code behind
public string btnlogin(role_id)
{
if(role_id==1)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString);
con.Open();
fill ur requirement
con.Close();
}
elseif(role_id==2)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString);
con.Open();
fill ur requirement
con.Close();
}
}