Advertisement

07.17.2008 at 05:59AM PDT, ID: 23572986
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

Full outer join with LINQ to Dataset example (work around)

Asked by TrafficTechDev in .NET, C# Programming Language, Microsoft Visual C#.Net

Tags: ,

Hi,
Base from what I am reading about LINQ Full outher join is not supported, and I could not really find a good example of a workaround for outer join in LINQ to Dataset.
Here is an example I would like to see working with LINQ to Dataset

Let's start with SQL server side with two tables
Table 1

CREATE TABLE [dbo].[ttsls](

[supp_inv_id] [int] NULL,

[family_id] [int] NULL,

[amount] [int] NULL

) ON [PRIMARY]

Table 2
CREATE TABLE [dbo].[imaging](

[family_id] [int] NOT NULL,

[image_name] [varchar](50) NULL

) ON [PRIMARY]

 

Here is the data in both tables
Table 1:
supp_inv_id            family_id            amount

----------- --------------------------------------------------
1                            11                         10
2                            12                         5
3                            13                         5
4                            NULL                   7
5                            NULL                   9

Table 2:
family_id         image_name
----------- --------------------------------------------------

11                     image1

12                     image2

13                    image3

16                    image3

17                    image4

Now I want to make a Full Join between these two tables with LINQ, let's start with SQL code
This SQL code would give me the results I would like to have:

Select
ttsls.supp_inv_id,
isnull(ttsls.family_id,imaging.family_id) as family_id,
ttsls.amount,
imaging.image_name
from
ttsls full outer join imaging on imaging.family_id = ttsls.family_id

Data:

supp_inv_id family_id family_id amount image_name
----------- ----------- ----------- ----------- --------------------------------------------------

1                11           11        10 image1

2               12            12        15 image2

3               13           13          5 image3

4              NULL       NULL      7 NULL

5              NULL      NULL       9 NULL

NULL       16          16            NULL image3

NULL       17         17            NULL image4

How would I get the same dataset using LINQ, let's say I have these two table in DataTable objects
How would I get this Outer join to work?
Thanks in advance

Start Free Trial
[+][-]07.17.2008 at 10:04PM PDT, ID: 22033002

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 06:38AM PDT, ID: 22035607

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 08:49PM PDT, ID: 22047944

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 01:57AM PDT, ID: 22048869

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET, C# Programming Language, Microsoft Visual C#.Net
Tags: Linq, c#, ADO.net, asp.net, IE6
Sign Up Now!
Solution Provided By: dungla
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.15.2008 at 04:19AM PDT, ID: 22237197

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 04:04PM PDT, ID: 22294762

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628