private void btnExecuteSQLAsDataTable_Click(object sender, EventArgs e) { try { lblTitle.Text = "Execute SQL to DataTable : GET ALL COUNTRIES"; string query = QueryBase.GetAllFrom(eTables.country); DataTable dataTable = null; Task.Factory.StartNew(() => { dataTable = sqlHandler.ExecuteSQL(query); }).Wait(); dgvResult.DataSource = dataTable; } catch (Exception ex) { DisplayError(ex.Message); } }
private void btnExecuteAsListUsingSQLQuery_Click(object sender, EventArgs e) { try { lblTitle.Text = "Execute As List Using SQL Query : GET LIST OF CITIES"; string query = QueryBase.GetAllFrom(eTables.city); List <City> lstCities = null; Task.Factory.StartNew(() => { lstCities = sqlHandler.ExecuteAsListUsingQuery <City>(query); }).Wait(); dgvResult.DataSource = lstCities; } catch (Exception ex) { DisplayError(ex.Message); } }