Hello,
I am using a TSmartQuery tied to a TDBGrid. I do not know the SQL of the SmartQuery at design time. It is entered by the user at runtime.
In most circumstances, ODAC does a fine job of insert/update/delete statements in response to the user editing the grid. But in certain circumstances, I want to handle it and generate my own SQL for SQLLock, SQLUpdate, SQLInsert, and SQLRefresh. But I am having a hard time getting started with this because I need to do it on the fly as user makes edits in the grid.
My questions are:
1) which event should I use to do that
and
2) how can I tell which fields have been modified?
Thank you.
-John Dorlon
question about SQLLock, SQLUpdate, SQLRefresh
Re: question about SQLLock, SQLUpdate, SQLRefresh
Specifically, the user is selecting a field by an expression and I would like to supply a different expression to be used for the update or insert.
Is this possible?
Is this possible?
Re: question about SQLLock, SQLUpdate, SQLRefresh
To implement the behavior you describe, use the BeforePost TSmartQuery event handler. For example, inside the handler you can change the text of SQLUpdate or SQLInsert queries and access the modified field values. However, in such case, the text of SQLUpdate or SQLInsert queries generated by our components will be unavailable. Please, explain exactly what criteria you will be guided to form or modify such requests. After such description and the task, we will be able to find the most convenient way to solve it with the help of our components.
Re: question about SQLLock, SQLUpdate, SQLRefresh
Hello,
Nevermind, I found a way to accomplish it....by using a separate editor instead of the grid. That way I can make my own update statements.
Thank you.
Nevermind, I found a way to accomplish it....by using a separate editor instead of the grid. That way I can make my own update statements.
Thank you.
Re: question about SQLLock, SQLUpdate, SQLRefresh
We are glad that you found a necessary solution. Please don't hesitate to contact us with questions concerning ODAC usage.