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 user_profile : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection cn; SqlCommand cmd; int id = int.Parse(Session["userid"].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 users where id={0}", id); string name = cmd.ExecuteScalar().ToString(); cmd.CommandText = string.Format("select mail from users where id={0}", id); string mailid = cmd.ExecuteScalar().ToString(); cmd.CommandText = string.Format("select no_proj_done from users where id={0}", id); string noproj = cmd.ExecuteScalar().ToString(); cn.Close(); Label1.Text = name; Label3.Text = mailid; Label2.Text = id.ToString(); Label4.Text = noproj; } catch (Exception ex) { } } }