TOraTable

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
nursbay
Posts: 3
Joined: Wed 18 Dec 2013 10:03

TOraTable

Post by nursbay » Wed 18 Dec 2013 10:16

Hello!Sorry for asking simple questions. But I have problem with editing database table with
TOraTable component. It is set as dataset to DataSource object,which in turn as datasource to DBGrid object. The problem is : when I am trying to edit data in column in DBGrid, it changes, but as soon as I exit the application(close the form) data in database table returns to previous values. I guess there is problem with comitting the update. So what should I do(what options must be set)to fix that ?
thanx in advance.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraTable

Post by AlexP » Wed 18 Dec 2013 13:40

Hello,

Such behavior can be caused by the following factors:
1) You have the CachedUpdates mode enabled. In this case. to apply updates, you should call the ApplyUpdates method of the modified DataSet;
2) Before data modification, you had manually started a transaction. In this case, you should explicitly call this transaction commit.

nursbay
Posts: 3
Joined: Wed 18 Dec 2013 10:03

Re: TOraTable

Post by nursbay » Thu 19 Dec 2013 03:28

AlexP, thank you for help! CachedUpdates value is false. So it must be second case.
How do I take controll of that transaction ? There is no code lines related to transaction in application,how could I create that manually ?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraTable

Post by AlexP » Thu 19 Dec 2013 13:15

Hello,

If you don't call StartTransaction by yourself, there is no need to explicitly call commit. In all the other cases, data must be saved on the server correctly. Please send a small sample reproducing the problem and the table creating script to alexp*devart*com

nursbay
Posts: 3
Joined: Wed 18 Dec 2013 10:03

Re: TOraTable

Post by nursbay » Fri 20 Dec 2013 04:05

Hello,
AlexP, I'm new to Delphi,and sorry that I cant explain well. Actually I didn't write any script.
1) I put TOraSession component on form. Set servername,username & password
2) Put TOraTable comp . Set table name.
3) Put DataSource.
4) Put DBGrid

And didn't actually change any settings on these components.
When run the project I see the row with 4 columns of data from test table.When I click on some column and modify data it works fine, but no change in database. The value in DBGrid column changes but in database table doesn't.

*I'm doing this just for testing. My actual task is a bit different. There DBGrid gets data from remote server via clientdataset and source is stored procedure,which returns cursor. So when the user edits data in DBGrid and clicks save button,the application should send request to server, to change data on remote db. Is it possible to do that ?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraTable

Post by AlexP » Fri 20 Dec 2013 09:36

Hello,


We still cannot reproduce the problem. Please send a sample reproducing the problem to alexp*devart*com
To work with cursors, you can use TOraQuery and set the following query in the SQL property:

Code: Select all

OraQuery.SQL.TEXT := 'BEGIN getDept(:cur); END;';
and correctly specify the parameter type:

Code: Select all

OraQuery.ParamByName('cur').DataType := ftCursor;
After opening the DataSet, data from the cursor will be displayed in the DBGrid. To edit data returned by the cursor, you should specify the corresponding queries in the SQLInsert, SQLupdate, etc., properties. For example, an updating query can look like the following:

Code: Select all

  OraQuery1.SQLUpdate.Text := 'UPDATE DEPT SET DNAME = :DNAME, LOC = :LOC WHERE DEPTNO = :OLD_DEPTNO';

Post Reply