Home > Net > For help, questions about ListView load data is slow
For help, questions about ListView load data is slow
Time:11-13
Read a list of data is 2000, in the local test fast, about 2 seconds, but change the database connection to the network server, speed is slow, about 30 seconds, speed quickly, the program is copied to the server database connection with the network IP or. Are all the same shall not affect the speed, the server bandwidth 5 m, please god help
Private void reminderListUpload () { Int num=0; Int qtid=int. Parse (this. CbGroupQuestionType. SelectedValue. ToString ()); LitRge=rgeM. GetListArray_P (DateTime. Now. ToString (" yyyy - MM - dd "), 1, qtid);//database query need to load data If (litRge. Count & gt; 0) { Enclosing lvReminderList. Items. The Clear (); This. LvReminderList. BeginUpdate (); Foreach (ReminderGrouping_ext_P rg litRge) in//traverse the query of data { Rg) reminderLogSum=rleS) CalcCount (" reminderId="+ rg. Id); This. BackgroundWorker1. ReportProgress (num); ListViewItem lv=new ListViewItem (); Lv. UseItemStyleForSubItems=false; Lv. Text=rg. Id. The ToString ();//set the first line shows the data //bind the remaining columns of data Lv. SubItems. Add ((num + 1). The ToString ()); Lv. SubItems. Add (rg) carNumber) Trim (), ToString ()); Lv. SubItems. Add (rg) custName) Trim ()); Lv. SubItems. Add (rg) custPhone1) Trim () + ", "+ rg. CustPhone1. The Trim ());
Lv. SubItems. Add (rg) questionTypeName) Trim ()); Lv. SubItems. Add (rg) reminderTime) ToString ()); Lv. SubItems. Add (rg. Few. ToString ()); Lv. SubItems. Add (rg) updateTime) ToString ()); Lv. SubItems. Add (rg) addTime) ToString ()); //after the row data to create added to the list Enclosing lvReminderList. Items. The Add (lv); Num++; } This. LvReminderList. EndUpdate (); } The else { Enclosing lvReminderList. Items. The Clear (); } }
CodePudding user response:
You give this code litRge=rgeM. GetListArray_P (DateTime. Now. The ToString (" yyyy - MM - dd "), 1, qtid);//database query need to load data Before and after adding a logging time; See if the database connection problems, and is the first time loading is quite slow, 30 seconds have a little not normal,
CodePudding user response:
1, the query need to query field, 2. Data query to the ListView paging display at https://www.cnblogs.com/suntanyong88/p/5531482.html