How do we use joins

4 posts, 0 answers
  1. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 20 May 2009 Link to this post

    Hi,
        I have the following MySQL statement
      Select application.ApplicationID ,application.ApplicationName ,resourcelibrary.ResourceFile from application
      Left JOIN resourcelibrary on resourcelibrary.ResourceID=application.AppIconID ;

    How can I achieve the same in OQL?
  2. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 20 May 2009 Link to this post

    Hi Paul,
    Oql unlike SQL is OOP language. You dont need joins because you work with objects. In your class application there should be a field resourcelibrary from which you can access resource file. Here is an example:
    Select x.ApplicationID,x.ApplicationName,x.ResourceFile from ApplicationExtent as x 
    Note that the result will be represented as a an array of objects. You can iterate with it using code similar to this:
     foreach (object[] obj in result) 
                { 
                    Console.WriteLine(obj[0] + " " + obj[1] + " "); 
                } 


    Greetings,
    PetarP
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 20 May 2009 Link to this post

    Hi,
        My application class does not have a  field resourcelibrary. How do I go about adding this using the reverse mapping wizard and linking the resourceID to the AppIconID.

    Regards
    Paul
  5. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 25 May 2009 Link to this post

    Hi Paul,
    when there is an relationship between two tables OpenAccess automatically picks this up and creates an object reference for you. If you have used the reverse mapping wizard and you haven't deleted this reference on purpose it should be there. Here is an article about the reverse mapping wizard that you might find useful.

    Kind regards,
    PetarP
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top