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 8540837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:41:31+00:00 2026-06-11T11:41:31+00:00

I have a data set say ‘ds’ which I populate from a table called

  • 0

I have a data set say ‘ds’ which I populate from a table called tran_dtls ,
now I want to write a method to this data set(or the table in the data set ‘dt’),which would effectively retrieve for me a scalar value having the same output as this query:

 select sum(amt) from TRAN_DTLS 
 where GL_CODE='" + row["gl_code"].ToString() + "' 
 and SUB_CODE='" + row["sub_code"].ToString() + "' 
 and DBCR='C'"

Here amt,GL_code,SUb_code,DBCR are the columns in tran_dtls table, So what I want to do is select the sum of amount having various conditions ,I have never done anything like this before so I don’t know even this would be possible or not

  • 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-06-11T11:41:32+00:00Added an answer on June 11, 2026 at 11:41 am

    I don’t think you can write SQL against a DataSet. But you can use LINQ:

    var ds = new DataSet();
    var tranDtls = new DataTable("tran_dtls");
    tranDtls.Columns.Add("gl_code", typeof(string));
    tranDtls.Columns.Add("amt", typeof(int));
    var row = tranDtls.NewRow();
    row["gl_code"] = "a";
    row["amt"] = 1;
    tranDtls.Rows.Add(row);
    ds.Tables.Add(tranDtls);
    
    var result = ds.Tables["tran_dtls"].AsEnumerable()
        .Where(r => (string)r["gl_code"] == "a")
        .Select(r => (int)r["amt"])
        .Sum();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have large data set, which I want to query. The query does not
Say I have a QTableWidget with 10 columns. I set data in the table
I have set up a Core Data model where I have two objects, say
I have a data set which consists of an ID and a matrix (n
I have two data tables in a data set for example lets say Servers:
I have a, say, daily income data set of numeric Temporal Properties , like:
I have some irregularly spaced data, say table A. The frequency is every 2-5
I have a problem while dealing with a data set which the value range
Lets say you want to write a high performance method which processes a large
Let's say I have a bunch of jQuery's .data() set for an HTML element

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.