private async void btnCount_Click(object sender, EventArgs e) { BULKCOPY bulk = new BULKCOPY(); var count = await bulk.GetCount().ConfigureAwait(false); MessageBox.Show(count.ToString(), "Total record"); }
private async Task LoadData(int page = 1, string query = "") { var start = (page - 1) * 10 + 1; var end = start + 10 - 1; BULKCOPY bulk = new BULKCOPY(); var count = bulk.GetCount(query); var lstBulk = bulk.SelectPaging(start, end, query); await Task.WhenAll(count, lstBulk); grvData.DataSource = lstBulk.Result; lblTotal.Text = count.Result.ToString(); lblCurPage.Text = page.ToString(); lblttPage.Text = (count.Result / 10) == 0 ? "1" : (count.Result / 10).ToString(); }