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.
TOraTable
Re: TOraTable
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.
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.
Re: TOraTable
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 ?
How do I take controll of that transaction ? There is no code lines related to transaction in application,how could I create that manually ?
Re: TOraTable
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
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
Re: TOraTable
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, 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 ?
Re: TOraTable
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:
and correctly specify the parameter type:
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:
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;';Code: Select all
OraQuery.ParamByName('cur').DataType := ftCursor;Code: Select all
OraQuery1.SQLUpdate.Text := 'UPDATE DEPT SET DNAME = :DNAME, LOC = :LOC WHERE DEPTNO = :OLD_DEPTNO';