Wednesday 22 August 2012

Simple DataTable in c# with count rows | For loop

How to count total number of rows from datatable in c#.


DataTable DtObject=new  DataTable(); 

            int cnt=0; //initialization count as 0.
       if(DtObject.Rows.Count!=null) // dt1.Rows.count will give information about total records or tital rows in datatable.
       {
           for (int i = 0; i < DtObject.Rows.Count-1; i++)
           {
               cnt += 1;
           }
           lblResult.Text = cnt.ToString();
          
          
       }
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: