/// <summary> /// Page_Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //判断是否存在该id的工程 int id = int.Parse(Request.QueryString["id"].ToString()); ProjectEntity pe = ProjectOperation.GetProject(int.Parse(Request.QueryString["id"].ToString())); if (pe == null) { SmallScript.MessageBox(Page, "不存在该工程!点击返回!"); SmallScript.GoBack(Page); return; } else { //在表单中显示数据 DataBase db = new DataBase(); DataSet sql = db.ExCommand(string.Format("SELECT tb_project.tid, tb_project.uid, tb_user.userName, " + "tb_project.description, tb_project.upTime, " + "tb_project.projectName, tb_type.typeName, tb_project.id FROM tb_project INNER " + "JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id WHERE (tb_project.id ={0} ) ", id)); string User = sql.Tables[0].Rows[0][2].ToString(); string Type = sql.Tables[0].Rows[0][0].ToString(); tb_ProjectName.Text = pe.ProjectName; lb_User.Text = User; db_Type.SelectedIndex = int.Parse(Type); tb_description.Text = pe.Description; lb_UpTime.Text = pe.UpTime.ToString(); lb_ID.Text = pe.Id.ToString(); } } }
/// <summary> /// Page_Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = int.Parse(Request.QueryString["id"].ToString()); ProjectEntity pe = ProjectOperation.GetProject(int.Parse(Request.QueryString["id"].ToString())); if (pe != null) { DataBase db = new DataBase(); DataSet sql = db.ExCommand(string.Format("SELECT tb_project.tid, tb_project.uid, tb_user.userName, " + "tb_project.description, tb_project.upTime, " + "tb_project.projectName, tb_type.typeName, tb_project.id FROM tb_project INNER " + "JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id WHERE (tb_project.id ={0} ) ", id)); string User = sql.Tables[0].Rows[0]["userName"].ToString(); string Type = sql.Tables[0].Rows[0]["typeName"].ToString(); //在表单中显示数据 lb_ProjectName.Text = pe.ProjectName; lb_Id.Text = pe.Id.ToString(); lb_description.Text = pe.Description; lb_User.Text = User; lb_UpTime.Text = pe.UpTime.ToString(); lb_Type.Text = Type; } } }