Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

I am having the Dataset. When i have tried to convert the datatable to generic list systtem rasised the Opereation Time Out error because of the the datatable having more than 5000 rows.
Kindly help us to convert the bulk datarows to the list fastly.

XML
private List<EventUpdation> GetListByDataTable(DataSet dt, string entryType)
       {

XML
List<EventUpdation> result = (from reader in dt.Tables[0].AsEnumerable()
                                          select new EventUpdation()
                                          {

ID = Utility.ToLong(reader["event_pid"]),
.
.
.//100 properties to be assined
.
.

return result;
}
}
Posted

1 solution

Try "old fashioned" loop:

C#
foreach (DataRow dr in dt.Tables[0].Rows)
{
   //..update your collection element here
}


But my suspicion is that problem is in the data itself. Is data coming from the database? Did you check how database query is performing outside of your code? More details you provide better answers you will get.
 
Share this answer
 
Comments
SPASWIN 2-Dec-13 9:50am    
We have received the error Operation Timed out which faced previously even used the above reference. Please note we are having the 5000 rows each row having 100 properties . While update the collection system raised the error.. Please let us know the any other way.. for the above issue..
SPASWIN 2-Dec-13 9:58am    
Also data are retried quickly(within 1 mint)from database and while converting to list only i m facing the issue.
Adam Zgagacz 2-Dec-13 10:02am    
It is really not enough information to work with. If you are getting timeout it must be coming from the reader (database). 5000 rows and 100 properties should be not a problem for handling by your program unless your database query is not performing well. Concentrate on the query you are using to retrieve data, see (outside of the program) how long it takes to return data, optimize it.
You can also try to increase query timeout while debugging.
Adam Zgagacz 2-Dec-13 10:07am    
1 minute is long. If I remeber correctly, default SQLTimeout is 30s.
Improve your query (preferred) or increase timeout.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900