using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Data; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; public partial class manager_profile : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection cn; SqlCommand cmd; int id = int.Parse( Session["managerid"].ToString()); string cs; cs = ConfigurationManager.ConnectionStrings["eofficedbcs"].ConnectionString; cn = new SqlConnection(cs); cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; try { if (cn.State == ConnectionState.Closed) cn.Open(); cmd.CommandText = string.Format("select name from manager where id={0}", id); string name = cmd.ExecuteScalar().ToString(); cmd.CommandText = string.Format("select mail from manager where id={0}", id); string mailid = cmd.ExecuteScalar().ToString(); cn.Close(); Label1.Text = name; Label2.Text = mailid; Label3.Text = id.ToString(); } catch (Exception ex) {} } }