private void UpdateUsersSettings() { lbxUserList.DataSource = null; lbxUserList.Items.Clear(); lbxUserList.DisplayMember = "UserDisplay"; lbxUserList.ValueMember = "ID"; lbxUserList.DataSource = mysql.CreateDataTable("SELECT CONCAT(Name, ' (', Username, ')') AS UserDisplay, ID FROM qd_users ORDER BY Name ASC"); }
private void tmrSearchCooldown_Tick(object sender, EventArgs e) { string searchQuery = txbSearchbox.Text; tmrSearchCooldown.Stop(); lbxSearchresult.DataSource = null; lbxSearchresult.Items.Clear(); string sqlQuery = "SELECT CONCAT('User: '******' (', qd_users.Username,')') AS Display, ID " + "FROM qd_users HAVING Display LIKE CONCAT('%', ?, '%') " + "UNION ALL " + "SELECT CONCAT('Device: ', qd_devices.LogonName, ' @ ', qd_devices.DeviceName) AS Display, ID " + "FROM qd_devices HAVING Display LIKE CONCAT('%', ?, '%')"; lbxSearchresult.DisplayMember = "Display"; lbxSearchresult.ValueMember = "ID"; lbxSearchresult.DataSource = mysql.CreateDataTable(sqlQuery, searchQuery, searchQuery); }