This is a migrated thread and some comments may be shown as answers.

join query result, typeof

1 Answer 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kwon OhJong
Top achievements
Rank 2
Kwon OhJong asked on 25 Nov 2009, 02:57 AM

OpenAccess Ver 2009.2.701.5

var query = @"
select *
   from order o
     join orderDetail od
      on o.order_id = od.order_id ";

var result = scope.GetSqlQuery(query
    , typeof(??????)
    , null).Execute();

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 25 Nov 2009, 08:20 AM
Hello Kwon OhJong,

Since you are doing a projection (combining columns from several tables) it does not make sense to supply a value for the second parameter, you can just pass null. Then the result will be an object array (object[]) and each element will be an object array itself, containing the values from all selected columns. More information about this method could be found in this help topic.

However, I would suggest you to consider using Linq queries as they are strongly-typed and checked for errors on compile time. To use Joins in Linq queries, you will have to upgrade to a newer version (the latest one is 2009.3 1119). Then you can take a look at our OpenAccess C# Linq Examples application which shows more than 100 Linq sample queries. They should be enough for you to understand the power of Linq and OpenAccess when used together.
Hope that helps.

Kind regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Kwon OhJong
Top achievements
Rank 2
Answers by
Alexander
Telerik team
Share this question
or