Fill a DataSet with nearly 20,0000 records using SqlDataAdapter I want to fill a DataSet with 20,0000 records using a SqlDataAdapter by using this code:

adapter.Fill(dataset);


If I fill a DataSet this way it takes a long time. Is there anything wrong with this?

This is my code:

connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
connection.Open(); 

SqlCommand command = new SqlCommand("sp_DMS_Report_Generate", connection); 
command.CommandType = CommandType.StoredProcedure; 
command.Parameters.AddWithValue("@XML", reportCriteria.XML); 
command.CommandTimeout = 1000; 

SqlDataAdapter adapter = new SqlDataAdapter(command); 
adapter.Fill(resultSet); 

return resultSet.Tables[0];
I would say the C# is fine, it's your database that is the issue.  Is the Stored procedure optimized?  Are the tables in the proper normalization?  Are your primary keys &amp; foreign keys set up properly? (you should get the point by now) 

Start there first since really everything is there.