join query result, typeof

Thread is closed for posting
2 posts, 0 answers
  1. Kwon OhJong
    Kwon OhJong avatar
    5 posts
    Member since:
    Mar 2005

    Posted 24 Nov 2009 Link to this post

    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();

  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 25 Nov 2009 Link to this post

    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.
Back to Top