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

  • Home
  • SEARCH
  • 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 6144977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:43:43+00:00 2026-05-23T18:43:43+00:00

I am stuck with the error value cannot be null. parameter name row when

  • 0

I am stuck with the error “value cannot be null. parameter name row” when I use Left join in Linq for DataSet.

Following is the data and the linq query.


  • DataRowCollection – items (Columns – Item_id, SKU, Quantity)

  • DataRowCollection – promotions (Columns – Item_id, Promotion_Id)

  • DataRowCollection – components (Columns – Component_id, Promotion_id)

  • DataRowCollection – amounts (Columns – Component_id, Amount_Text, currency)

        var q = 
            from Item in items
            join promotion in promotions
                on Item.Field<int>("Item_id") equals promotion.Field<int?>("Item_id") into promo
            from promotion in promo.DefaultIfEmpty()
            join disccomponent in components
                on promotion.Field<int>("Promotion_Id") equals disccomponent.Field<int?>("Promotion_Id")
            join discamounts in amounts
                on disccomponent.Field<int>("Component_id") equals discamounts.Field<int?>("Component_id")
            where disccomponent.Field<string>("Type") == "Principal"
            select new
            {
                SKU = Item.Field<string>("SKU"),
                Quantity = Item.Field<string>("Quantity"),
                DiscountAmount = discamounts.Field<string>("Amount_Text"),
                DiscountCurrency = discamounts.Field<string>("currency")
            };

I need to get the following:


  • SKU, Qty and Discount details for items which have discount

  • SKU, Qty for items which do not have any discount

The code worked without left outer join when all items had discount, but if any item does not have any discount it skips that item and hence I had to use the left outer join.

Any help is highly appreciated. Please let me know if any clarification is needed.

Thanks in advance.

  • 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-23T18:43:43+00:00Added an answer on May 23, 2026 at 6:43 pm

    Thanks everyone for your help. I made this work by splitting it into 2 different linq queries below.

    The first query gets the promotion data in a var

            var promoData =
                    from promotion in promotions
                    join component in components
                        on promotion.Field<int>("Promotion_Id") equals component.Field<int?>("Promotion_Id")
                    join amount in amounts
                        on component.Field<int>("Component_id") equals amount.Field<int?>("Component_id")
                    where component.Field<string>("Type") == "Principal"
                    select new
                    {
                        Item_id = promotion.Field<int?>("Item_id"),
                        Promotion_id = promotion.Field<int>("Promotion_Id"),
                        DiscountAmount = amount == null ? "" : amount.Field<string>("Amount_Text"),
                        DiscountCurrency = amount == null ? "" : amount.Field<string>("currency")
                    };
    

    The second query uses the promotions var to simplify the query and get the resuls

            var q = 
                from Item in items
                join promotion in promoData
                    on Item.Field<int>("Item_id") equals promotion.Item_id into promo
                    from promoJoin in promo.DefaultIfEmpty()
                select new
                {
                    SKU = Item.Field<string>("SKU"),
                    Quantity = Item.Field<string>("Quantity"),
                    DiscountAmount = promoJoin != null ? promoJoin.DiscountAmount : "0",
                    DiscountCurrency = promoJoin != null ? promoJoin.DiscountCurrency : ""
                };
    

    This approach works perfectly and I get all the items whether they have promotions or not. I am still thinking whether doing the same was possible in a single query 🙂
    For now marking this as an answer, if anyone comes up with some other better way will mark that.

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

Sidebar

Related Questions

Trying to use StackLL method size() is returning a null pointer error. I cannot
I'm getting the following Designer Error in VS2008 : Object of type 'Data.TimeLineChartedDay[]' cannot
Apparently, you cannot use a null for a key, even if your key is
hey guys, i'm getting an exception on the following inner exception: {Value cannot be
Being stuck with a legacy database schema that no longer reflects your data model
I'm stuck with .Net 1.1 application (i.e. I can not use the generics goodies
I cannot figure out why I keep getting a null ref on filename when
I am stuck on what I thought was a simple PEBCAK error on my
I keep running into the 'cannot find symbol' error on my class. The variable
Using SPMETAL I've generated a C# file allowing me the use of LINQ to

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.