Updating rows in memory DataTable


I'm interesting if its posible to update row of DataTable with new data.

I'm creating table:

DataTable OutTable=new DataTable("IndexTicker");
After I insert rows in table I want to update every 10 secound data
in table with new index data. Primary colomn is IndexCode.

Any idea?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is this an ASP.NET application, or a Windows Forms application.
The direction to go depends greatly on which of these your writing for.

tomazsrAuthor Commented:
Windows form application that use Web Services and I want that
requery on web services (lasts 3-5 secound) run in separate thread.

Try using the System.Timers.Timer component.
Set the Interval to be 6 seconds to make update ~10 seconds (9 to 11sec.)
Handle the Timer.Elapsed event.
In the method handling the Timer.Elapsed event, query the webservice, get the data.
Find the row using:
DataRow[] rows = OutTable.Select("IndexCode = " + IndexCodeOfRowToUpdate);
if(rows.Length == 1) { // If one row match found
    DataRow r = (DataRow)rows.GetValue(0);
    r["columnName"] = webServiceDataForColumnName;

NOTE: This would only allow updating of one row (one selected in datagrid maybe?) every ten seconds,
          did you want to update each row on its own 10sec interval starting from when added? (little more complicated)

I think this is what you want.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.