HOW TO USE UPDATE SYNTAX IN OQL BROWSER

4 posts, 0 answers
  1. kottu
    kottu avatar
    23 posts
    Member since:
    Mar 2009

    Posted 04 May 2009 Link to this post

    How to use update query in OQL browser????????????

    Give some examples

    anyone help me,

    regards,
    vignesh

  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 05 May 2009 Link to this post

    Hello kottu,

    OQL does not have an UPDATE statement. Although it looks like SQL, OQL is object oriented and you should use the objects directly to change their data.

    Sincerely yours,
    Alexander
    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. kottu
    kottu avatar
    23 posts
    Member since:
    Mar 2009

    Posted 05 May 2009 Link to this post

    Can you give Some examples?????????????

    thanks,
    regards,
    vicky

  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 08 May 2009 Link to this post

    Hi kottu,

    With OQL you can retrieve an object, modify it as you wish and then store it back to the database. Here is an example:
    IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope(); 
    scope.Transaction.Begin(); 
     
    //retrieve an object using its id 
    Order order = (Order)scope.GetOqlQuery("Select * from OrderExtent Where OrderID = 10248").Execute()[0]; 
     
    //make some modifications to the object 
    order.Freight++; 
     
    //store the modified object 
    scope.Transaction.Commit(); 
    As you see OQL is used only for retrieving data. This is why you cannot use the OQL Query browser to update data. There you can only test if your OQL Select statement returns the desired result.

    Greetings,
    Alexander
    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