asp.net - How to paging in datatable using C# -


i want read file between 2 date , add value datatable. want show datatable value in grid paging. problem these file contains huge amount of data (more 1m) if use gridview default paging application hang. want paging in datatable.so how can that? idea of sample code please.

public datatable createdatasource(datetime fromdate, datetime todate) {     int = 0;     string visitorcountry = "";     try     {         dt = dtvisitlog();         (datetime x = fromdate; x <= todate; x = x.adddays(1))         {             string startdate = x.year.tostring().substring(2, 2) + x.month.tostring("d2") + x.day.tostring("d2");             string file_name = pathname + "\\u_ex" + startdate + ".log";             if (file.exists(file_name))             {                 filestream fs = new filestream(file_name, filemode.open, fileaccess.read,                                                fileshare.readwrite);                 streamreader sr = new streamreader(fs);                 string strresult = sr.readtoend();                 sr.dispose();                 fs.dispose();                 sr = null;                 fs = null;                 string[] arloglines = strresult.split(convert.tochar("\n"));                  (i = arloglines.length-2; > 3; i--)                 {                    string[] attribute = arloglines[i].split(convert.tochar(" "));                                    dt.rows.add(attribute[0], attribute[1], attribute[8], attribute[4], attribute[7], visitorcountry);                 }             }         }         return dt;     }     catch (exception ex)     {         return null;     } } 

according msdn, datatable limit 16,777,216 rows. when load huge data datatable impact on performance of application , server memory. better 1st store huge data database sql server or other database. display data using row number function (if use ms sql 2005 or 2008). if use sql server 2012 can use fetch . if you use mysql server can use limit displaying limited data @ time. try explain you need server side pagination not client side pagination in situation. thanks.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -