void Namelist() { if (con.State == ConnectionState.Closed) con.Open(); cmd.CommandText = "select * from [EmployeeData] where Section='GA&HR'"; cmd.Connection = con; SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds, "EmployeeData"); con.Close(); DropDownList6.DataSource = ds.Tables["EmployeeData"]; DropDownList6.DataTextField = "Name"; DropDownList6.DataValueField ="EmployeeID"; DropDownList6.DataBind(); DropDownList6.Items.Insert(0, "เลือกชื่อพนักงาน"); } protected void DropDownList6_SelectedIndexChanged(object sender, EventArgs e) { if(!Page.IsPostBack) { if (con.State == ConnectionState.Closed) con.Open(); cmd.CommandText = "select * from [EmployeeData] where Name=@pName"; cmd.Parameters.AddWithValue("@pName",DropDownList6.SelectedValue); cmd.Connection = con; SqlDataReader rd = cmd.ExecuteReader(); while(rd.Read()) { TextBox15.Text = rd[0].ToString(); TextBox19.Text = rd[2].ToString(); TextBox21.Text = rd[3].ToString(); } rd.Close(); con.Close(); } }
protected void DropDownList6_SelectedIndexChanged1(object sender, EventArgs e) { if (con.State == ConnectionState.Closed) con.Open(); cmd.CommandText = "select * from EmployeeData where Name='" + DropDownList6.SelectedItem.Text + "'"; cmd.Connection = con; SqlDataReader rd = cmd.ExecuteReader(); if(rd.Read()) { TextBox15.Text = rd.GetValue(0).ToString(); TextBox19.Text = rd.GetValue(2).ToString(); TextBox21.Text = rd.GetValue(3).ToString(); } rd.Close(); con.Close(); } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง