public void carregaDades() { string query = "SELECT * FROM " + Taula; DataSet dtSet = new DataSet(); SQLConnection.BbddChampions bd = new SQLConnection.BbddChampions(); dtSet = bd.PortarPerConsulta(query); this.DataSource = dtSet.Tables[0]; }
private void Menu_Load(object sender, EventArgs e) { lbl_name.Text = Nom; lbl_user.Text = "@" + User.Trim().ToLower(); moreOptions.Size = new System.Drawing.Size(0, 0); if (File.Exists(Path.GetFullPath("../Resources/" + Foto))) { img_profile.ImageLocation = "../Resources/" + Foto; } else { img_profile.ImageLocation = "../Resources/Usuari.png"; } DataSet dtsMenu; SQLConnection.BbddChampions bd = new SQLConnection.BbddChampions(); string consulta = "SELECT * FROM FORMS WHERE RANG <= " + Int32.Parse(AccessLevel) + " ORDER BY FORMS.ID DESC;"; dtsMenu = bd.PortarPerConsulta(consulta); foreach (DataRow dr in dtsMenu.Tables[0].Rows) { OpcionsMenu Opcio = new OpcionsMenu { Dock = DockStyle.Top, NomFormulari = dr["NOMFORMULARI"].ToString(), Descripcio = dr["DESCRIPCIO"].ToString(), DLL = dr["DLL"].ToString(), imatgeOpcio = dr["IMG"].ToString(), Rang = dr["RANG"].ToString(), }; panelMenu.Controls.Add(Opcio); } }