Print Page | Close Window

Create Query...ufff

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1798
Printed Date: 11-Mar-2025 at 3:45pm


Topic: Create Query...ufff
Posted By: master-of-disaster
Subject: Create Query...ufff
Date Posted: 08-May-2010 at 1:58am
Hello,
 
I'm a newbie in ideablade and SQL Database and so on.
Now I'm try to learn, create queries for different relation.
Most works fine.
 
But I try to read countrycode like in the following query in linq to sql, to solve the result with DevForce SL in my SL App.
Hier my Databasediagram to see my foreignkeys / relation http://www.ideablade.com/forum/uploads/682/Schema.zip -  
I've try following query, but I get no result.

public class MainPageViewModel

{

public MainPageViewModel()

{

TestNames = new ObservableCollection<TestName>();

var mgr = new TestEntities();

var query = mgr.TestNames.Include("TestOrders.TestCountries").Include("TestAdresses");

query.ExecuteAsync(op => op.Results.ForEach(TestNames.Add));

}

public ObservableCollection<TestName> TestNames { get; private set; }

}

When I try this, without "CountryCode" it works fine. I think, my problem is the relation between TestOrder * : 1 TestCountry. When I use an examples with relation 1 : * and not * : 1 Example: Include("Test.Test2") seems to work.
 
var query = mgr.TestNames.Include("TestOrders").Include("TestAdresses");
 
I think, Include is not the right way... What I've to do? Have any one an example to build a query with join?
When try to use join, I get an error by query.ExecuteAsync(op => op.Results.ForEach(TestNames.Add));
TestNames doens't match.
I don't find any comlex examples, is there anyone who can show me, what I do wrong?
 
Regards
Dirk



Print Page | Close Window