title: how to load large amount of data in datatable?
body: <p>In my mvc application we need to load more than 100000 record at a time but while retrieving such amount of data my browser get crashed..</p>
  
  <p>following is my code</p>
  
  <pre><code>string sql = "SELECT * FROM DBO.MY_TEST_DATA";
  //MSSQL CONNECTION STRING
  string myCnString = "Data Source=MYIPSERVER;Initial Catalog=my_database;
  Persist Security Info=True;User ID=sa;Password=myPwd";
  DataTable dt = GetDataTable(myCnString, sql);
  //Todo: Use the table data
  
      public DataTable GetDataTable(string cnString, string sql)
      {
      using (SqlConnection cn = new SqlConnection(cnString))
          {
           cn.Open();
  
              using (SqlDataAdapter da = new SqlDataAdapter(sql, cn))
              {
               da.SelectCommand.CommandTimeout = 120;
                  DataSet ds = new DataSet();
                  da.Fill(ds);
                  return ds.Tables[0];
              }
          }
      }
  </code></pre>