hi
shameer
try this Code
SqlConnection sqlconAdmin = new SqlConnection(ConfigurationManager.ConnectionStrings["Adminconstr"].ToString());
SqlConnection sqlconUser = new SqlConnection(ConfigurationManager.ConnectionStrings["Userconstr"].ToString());
SqlCommand sqlcmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserRole"].ToString() == "Admin")
{
//Use sqlconAdmin follow them
}
else if (Session["UserRole"].ToString() == "User")
{
//Use sqlconUser follow them
}
if (!Page.IsPostBack)
{
GridView1.ShowFooter = true;
LoadGrid();
}
}
Your WebConfig Like This 2 connections
<add name="Adminconstr" connectionString="Data source=PcNAme;Initial Catalog=Test;User Id=sa;Pwd=yrpwd;" providerName="System.Data.SqlClient"/>
<add name="Userconstr" connectionString="Data source=PcName;Initial Catalog=Test;User Id=sa;Pwd=yrpwd;" providerName="System.Data.SqlClient"/>
Mark as Answer if its helpful to you
Kumaraspcode2009@gmail.com
Shameer.Ali87, if this helps please login to Mark As Answer. | Alert Moderator