Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Updating rows in memory DataTable

Posted on 2003-10-24
3
407 Views
Last Modified: 2010-04-16
Hi,

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?

Thanks
Tomaz
0
Comment
Question by:tomazsr
  • 2
3 Comments
 
LVL 6

Expert Comment

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

ZRH
0
 
LVL 1

Author Comment

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

Tomaz
0
 
LVL 6

Accepted Solution

by:
zrh earned 250 total points
ID: 9631566
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.
ZRH
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question