Retrieving Data from DataView C# takes too long

I have a DataTable named 'dtStocksCriteria'; each cell in it should turn into a process function. So I should traverse all rows and columns.

For this purpose I have Parallel loop on rows. Then I select the Row with this Code:

DataView dv = new DataView(dtStocksCriteria);
                dv.RowFilter = "xStockCode_FK = " + stock.Code;

After that in an Inner Parallel loop I should retrieve each column value with something like this code.

val = (double)dv[0]["column name"];

This Assignment take about 0.5 seconds which is too long for me. I want to reduce that to approximately 1 millisecond.

I have 398 rows and 110 columns in mt data table, in case that helps.

Does anyone have any ideas?

Answers


In C# working with DataView or DataRow or DataTable takes time. BUT If you use DataRow[int index] to retrive a cell value it should takes less time than using DataRow[string ColumnName] .

SO

When I use 'index' instead of 'ColumnName' it makes my code faster.

BUT

It is still slow because I have too much columns. So the best solution is to reduce the columns count first.


Need Your Help

How can I implement Declaration to bouncy ball?

java android acceleration

i am trying to implement Deceleration on the bouncy ball. i am able to move the ball up and down but i wanted to add Declaration so when i drop the ball from height it jumps then strike the ground ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.