Solved

Updating rows in memory DataTable

Posted on 2003-10-24
3
411 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
[X]
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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 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