如何从SQLite获取超过一百万行的数据时使用进度和backgroundWorker栏

问题描述 投票:0回答:1

我想在从SQLite数据库读取数据时通知用户,因此我决定创建一个带有进度条的表单,但是它不起作用。我使用实体框架从数据库获取数据并在数据网格视图中显示数据。数据大小超过一百万行。下面的代码我用它来获取数据:

var selectRow = from temp in mbdbe.tblManuscripts.AsNoTracking()
                        select temp;
  var terms = search.Split(' ');
  var all = selectRow.ToList().Where(q => (terms.All(term => q.tblManuscripts_ConvertTitle.Contains(term))) && q.tblManuscripts_Class.Contains(cmbSearchClass.Text)).ToList();                   

        if (all.Count > 0)
            dgv.Rows.Add(all.Count);
        for (int i = 0; i < all.Count; i++)
        {
            dgv.Rows[i].Cells[0].Value = all[i].tblManuscripts_Id;
            dgv.Rows[i].Cells[1].Value = i + 1;
            dgv.Rows[i].Cells[2].Value = all[i].tblManuscripts_Title;
            dgv.Rows[i].Cells[3].Value = all[i].tblManuscripts__AutherName;
            dgv.Rows[i].Cells[4].Value = all[i].tblManuscripts_Class;
            dgv.Rows[i].Cells[5].Value = all[i].tblManuscripts_Lib;
            dgv.Rows[i].Cells[6].Value = all[i].tblManuscripts_FirstNum;
            dgv.Rows[i].Cells[7].Value = all[i].tblManuscripts_SecondNum;
            dgv.Rows[i].Cells[8].Value = all[i].tblManuscripts_Countery;
            dgv.Rows[i].Cells[9].Value = all[i].tblManuscripts_Lang;
            dgv.Rows[i].Cells[10].Value = all[i].tblManuscripts_CopyName;
            dgv.Rows[i].Cells[11].Value = all[i].tblManuscripts_CopyDate;
            dgv.Rows[i].Cells[12].Value = all[i].tblManuscripts_PaperNum;
            dgv.Rows[i].Cells[13].Value = all[i].tblManuscripts_First;
            dgv.Rows[i].Cells[14].Value = all[i].tblManuscripts_Last;
            dgv.Rows[i].Cells[15].Value = all[i].tblManuscripts_Dis;
            dgv.Rows[i].Cells[16].Value = all[i].tblManuscripts_Font;
            dgv.Rows[i].Cells[17].Value = all[i].tblManuscripts_Ink;
            dgv.Rows[i].Cells[18].Value = all[i].tblManuscripts_PageSize;
            dgv.Rows[i].Cells[19].Value = all[i].tblManuscripts_TextArea;
            dgv.Rows[i].Cells[20].Value = all[i].tblManuscripts_LinesNum;
            dgv.Rows[i].Cells[21].Value = all[i].tblManuscripts_TextStatus;
            dgv.Rows[i].Cells[22].Value = all[i].tblManuscripts__Source;
            dgv.Rows[i].Cells[23].Value = all[i].tblManuscripts_Notes;
        }
c# progress-bar desktop-application
1个回答
0
投票

我等待程序员的回答

© www.soinside.com 2019 - 2024. All rights reserved.