Solved

VB.Net - DataTable Add Column and Perform Calculation

Posted on 2015-02-03
2
466 Views
Last Modified: 2015-02-03
Good Day Experts!

I have a little project going on here that I am looking for a bit of help on.  I have a DataTable that is filled with query results from a SQL query.  Once I fill that DataTable I would like to add a column to the DataTable and then put in the column the value of subtracting 2 columns that were already present in the DataTable.  

I have added the column.  But now how do I subtract two columns in the DataTable and put the results in this new column:

tblGetExportReseachFinal.Columns.Add("Count Remaining", Type.GetType("System.Integer"))

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40586545
By going through each row and doing that calculation. I don't believe there is an automatic way.
0
 

Author Comment

by:Jimbo99999
ID: 40586846
Thanks...have it working iterating through each row.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now