public void PagesList() { lsvPages.Items.Clear(); pages.Clear(); AsyncMysqlQuery query = new AsyncMysqlQuery("CALL sp_GetPages();"); query.SetHandler(delegate(MySqlDataReader reader) { if (query.Error == null) { while (reader.Read()) { Pages page = new Pages(reader); ListViewItem lsvItem = new ListViewItem(page.Title); lsvItem.Tag = page.Id.ToString(); pages.Add(page.Id, page); lsvPages.Invoke(new DelegateVoid(delegate() { lsvPages.Items.Add(lsvItem); })); } } else { MessageBox.Show("something went wrong"); } }); Database.Herbals.ExecuteSync(query); }
/******************* * Pages Sorted List *******************/ public static List<Pages> GetAllAccounts() { List<Pages> accounts = new List<Pages>(); AsyncMysqlQuery query = new AsyncMysqlQuery("CALL swganh_utility.sp_AdminAccountList();"); query.SetHandler(delegate(MySqlDataReader reader) { if (query.Error == null) { while (reader.Read()) { Account account = new Account(reader); accounts.Add(account); } } else { Console.WriteLine("something went wrong"); } }); Database.Utility.ExecuteSync(query); return accounts; }