Page 1 of 1
Refresh record not working
Posted: Mon 25 Aug 2014 14:37
by Valgardur
When calling refresh record (to get fields form joined table) nothing refresh actually happens.
The user is inserting a record in one form and I would like to update the grid view on another form without refreshing the whole dataset (which does work). To be sure I kept the key value and located the record, as well as refreshing the grid in other form.
PS I did try "SmartFetch" but it resulted in an invalid SQL error message.
Re: Refresh record not working
Posted: Tue 26 Aug 2014 08:09
by AlexP
Hello,
The RefreshRecord method updates the current record in the DataSet. in order for new records inserted externally to be added to the DataSet automatically, you should use the OraChangeNotification component. You can find a sample of working with this component in the ODAC demos.
P.S. Please provide the error message text or a screenshot at using SmartFetch, as well as the query causing the error.
Re: Refresh record not working
Posted: Tue 26 Aug 2014 10:37
by Valgardur
The record is already visible in the dataset, the user inserts a record, the key fields of the new record are displayed correctly in the form with the grid. After post/commit I locate the new record in the grid and call RefreshRecord, hoping to update values from other tables, tables joined in a query.
PS. I will have to send this later I don't have access at the moment..
Re: Refresh record not working
Posted: Tue 26 Aug 2014 10:58
by Valgardur
The SmartRefresh produces ORA-00933: SQL command not properly ended.
Without SmartRefresh it works fine, normal Refresh as well, RefreshRecord does not give an error, but does not work. I can send you the query in an e-mail, but I cannot post here.
Re: Refresh record not working
Posted: Tue 26 Aug 2014 11:17
by AlexP
If you are using JOIN, you should specify the correct query by yourself to for record update in the SQLRefresh property of this DataSet. By default, a query is generated for one table (the first one in the query).
Re: Refresh record not working
Posted: Tue 26 Aug 2014 11:21
by Valgardur
That would not work.
Refresh works fine, but it is a large dataset and I am looking for a way be able to refresh just this record of the query result.
Re: Refresh record not working
Posted: Tue 26 Aug 2014 13:43
by AlexP
The SQLRefresh property is designed for updating one record. For this, SQL must have an update condition with a parameter, to which the unique key will be put for this query. For example, if your main query is like the following:
Code: Select all
SELECT D.DEPTNO, D.DNAME, E.EMPNO, E.ENAME FROM DEPT D, EMP E WHERE D.DEPTNO = E.EMPNO
then the following record update query will be generated automatically:
Code: Select all
SELECT DEPTNO, DNAME FROM DEPT WHERE DEPTNO = :DEPTNO
In the SQLRefresh property, you should set an update query, that will take into account the second table too, i.e.:
Code: Select all
SELECT D.DEPTNO, D.DNAME, E.EMPNO, E.ENAME FROM DEPT WHERE D.DEPTNO = E.DEPTNO AND D.DEPTNO = :DEPTNO AND E.EMPNO = :EMPN
O
In this case,when calling RefreshRecord, only one column with the current values of the DEPTNO and EMPNO key fields will be updated.
Re: Refresh record not working
Posted: Tue 26 Aug 2014 13:52
by Valgardur
Thanks, OK my misunderstanding.. I thought that SQL Refresh was used to refresh the dataset as well, and as it worked fine I assumed it would for RefreshRecord..
Re: Refresh record not working
Posted: Tue 26 Aug 2014 15:03
by AlexP
Please provide the text of the query leading to the error in the SmartFetch mode. In addition, please specify the options of the DataSet, whose values differ from the default ones.
Re: Refresh record not working
Posted: Tue 26 Aug 2014 15:04
by Valgardur
Can I send the query by an e-mail?
Re: Refresh record not working
Posted: Wed 27 Aug 2014 07:38
by AlexP
You can send the query to alexp*devart*com .