private void Form2_Load(object sender, EventArgs e) { label5.Text = "To update a new user simply click on there name to the left \n edit the form and click Update User"; myConnection.GetConnection(); DataSet sds = new DataSet(); MySqlCommand sql = new MySqlCommand("SELECT * FROM users", myConnection.GetConnection()); MySqlDataAdapter mydap = new MySqlDataAdapter(sql); mydap.Fill(sds, "users"); this.UserList.DataSource = sds.Tables["users"]; this.UserList.DisplayMember = "name"; } private void UserList_SelectedIndexChanged(object sender, EventArgs e) { //int cid = Int32.Parse(this.UserList.SelectedValue.ToString()); MySqlCommand sql1 = new MySqlCommand("SELECT * FROM users WHERE name = '" + this.UserList.SelectedValue.ToString() + "'", myConnection.GetConnection()); MySqlDataAdapter DA = new MySqlDataAdapter(sql1); DataSet DS = new DataSet(); DA.Fill(DS, "users"); this.Usernametxtbox.Text = DS.Tables[0].Rows[0]["name"].ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)