Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6036857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:59:12+00:00 2026-05-23T05:59:12+00:00

i have managed to connect to an interbase database and get data from the

  • 0

i have managed to connect to an interbase database and get data from the database and store it in a dataset, i need to manipulate some of the data in the dataset and do something like the following,

add a new column in the dataset called total,
for each row i need to add the 2nd and 3rd column and place the result into the total column.

can some one shed some light on how i may do this, im using the following code to get the data into a data set.

    OdbcConnection conn = new OdbcConnection();
    conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString;

    DataSet ds = new DataSet();

    OdbcDataAdapter da = new OdbcDataAdapter("SELECT * FROM MTD_FIGURE_VIEW1", conn);

    da.Fill(ds);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:59:13+00:00Added an answer on May 23, 2026 at 5:59 am

    IF you are sure that your column values would never be null or empty then the best way is

    ds.Tables[0].Columns.Add("Sum", typeof(double), "Col1 + Col2");
    

    In case if your any column’s value will be null then it wont give any exception but the total value would also be empty …

    If there can be any null value then try this

               dt.Columns.Add("Total", typeof(double));
            foreach (DataRow dr in dt.Rows)
            {
                if (String.IsNullOrEmpty(dr["col1"].ToString()))
                    dr["col1"] = 0.0;
                if (String.IsNullOrEmpty(dr["col2"].ToString()))
                    dr["col2"] = 0.0;
    
                dr["Total"] = Convert.ToDouble(dr["col1"]) + Convert.ToDouble(dr["col2"]);
            }
    

    In this case if you never check for null or empty value then this will give you a run time exception…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have managed to display data in one column table, but would like to
i need to connect to another server we manage and have it's results (in
I have managed to get a cron job to run a rake task by
So far I have managed to write some code that should print the source
Ok so I have managed to get the format of the date presented in
I've managed to connect from SBCL running on debian to an SQL Server 2000
I have a DBAdmin class that connects to the database, and then some other
[edit] We're collecting credit application data from users on a web form. I have
i'm building my web application to connect with db. so far i have managed
I have managed to connect to msn through jml library on android by adding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.