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

HOW TO USE UPDATE SYNTAX IN OQL BROWSER

3 Answers 301 Views
OQL (OQL specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
kottu
Top achievements
Rank 1
kottu asked on 04 May 2009, 05:15 AM
How to use update query in OQL browser????????????

Give some examples

anyone help me,

regards,
vignesh

3 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 05 May 2009, 10:50 AM
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.
0
kottu
Top achievements
Rank 1
answered on 06 May 2009, 04:33 AM
Can you give Some examples?????????????

thanks,
regards,
vicky

0
Alexander
Telerik team
answered on 08 May 2009, 12:45 PM
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.
Tags
OQL (OQL specific questions)
Asked by
kottu
Top achievements
Rank 1
Answers by
Alexander
Telerik team
kottu
Top achievements
Rank 1
Share this question
or