I have an access database where the combo drop down box is a link table in SQL. Whenever i update the drop down value in SQL i have to close the form and re-open to see the changes. Question? Can i use Combo1.Requery or me.refresh in event Got Focus and Lost Focus?
Related
Using FireDAC in Delphi 10.2 to a Firebird 2.5 database, seeing a behavior I don't understand.
I open a TFDTable, Locate a desired record, call Edit and update some fields in that record and then call Post. If, after doing this and while the program is still running and the DB connection open, I open the DB in FlameRobin or other external data viewer and view the table, the changes I posted aren't visible in that external viewer and don't become visible until I close the DB connection as the program terminates. If I instead use a TFDQuery and normal transaction handling to UPDATE the same fields via SQL statement, the changes become visible in the external viewer immediately after the transaction is committed and I refresh the external view.
TFDTable.CachedUpdates and Exclusive are both False; Fetch, Field and Update options are at defaults; and UpdateObject and UpdateTransaction are unassigned.
What am I missing here? Thanks!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
It is posible start a transaction in one action and excute a rollback in another? This is why I wanna do this:
I am making an application where the user can generate an order and that order can have multiple services so I have 2 models related Order and Service. There is a form with some radio buttons and textarea where the user is going to introduce the characteristics of the service and it have 2 submit buttons, one for add more services to that order and the second next. when the user click on next is going to be redirect to a page where he can see all the services and a button for save, if the user click on save then I wanna save the order and all services(5 services generate are 5 records on the table Service and one record on the table Order). But if the user start add services and in some point decide leave the page I don't wanna save anything.
I think this can be done with some sort of rollback or maybe there is another way.
short answer: no not really.
Longer answer: transactions are, by their very definition atomic. They do what is to be done within them, then either commit or rollback.
you can't spread them over two server actions the way you are proposing, because by the end of the first action, the transaction must either commit or rollback... by the time the server gets the second action - either one or the other has already happened.
The way this is usually solved is to add a State to your order. eg a boolean column called "is committed" or something similar. The order can be created in a "not committed" state - and all your other actions only fetch and work with "committed" orders. If the user leaves the page, you can have a sweeper process clean up any uncommitted orders (ie delete them if a non-committed order is over 2 hours old).
I'm making a 'check_list' for my company. Each row of the table will be ONE event with 10+ check boxes that are labeled with the table header. Each time a check box is clicked I want to save that user's ID and Date. Is there a way to call a server side method to save this without submitting a form?
I just don't want to use a submit button because I need as much room as possible for check boxes.
I welcome any ideas or tips/tricks.
I am using Ruby on Rails.
Use jQuery, attach to the change event, and use ajax to call the method.
two hours of searching and reading and I am no closer.
Using D5, Zeos v6 SQLite I have Table with the rows displayed in a DBGrid. All fine.
I use
DELETE FROM tblOne WHERE Acct="FirstEntry"
and it deletes the only row that matches. Still all fine - but the DBGrid display stays the same still showing the row just deleted.
I read that closing and opening the TTable assigned to tblOne will refresh the display (as will tblOne.Refresh) which is fine for this test, but sometimes I will not know which Table it is, all I will have is the Table Name. There is no "OPEN", "CLOSE" or "REFRESH" command in SQLite that I can find.
So, how can I refresh the DBGird display to show the record has been deleted?
(edit)
I know I can use
dbgrid1.DataSource.DataSet.Refresh;
but, how does one refresh a display using SQL statements? Or is it not possible?
(edit)
A short line of code would help to describe the process.
Thanks
I am using TADOConn and TADODataSet units pulling data and connected to TDataSources and TDBGrids. I have my DBGrids displaying information properly and editing information in the detail view accurately reflects in the backing database.
What I would like to do is have it so that an update to a field in the detail DBGrid causes a refresh on both data sets so that the most up-to-date data is always displayed.
I have tried putting the refresh calls in several event handlers at various levels of DB access but they all seem to have a similar (but different) issue of reentry.
The best I've been able to come up with so far is getting the Master view updated by calling refresh on the details DBGrid.onColExit event.
If I leave the refresh calls out all together the updated information isn't displayed until the next time the application is run.
Any ideas of how to achieve this? Am I going about it the wrong why? Thanks in advance.
You imply that the changes you make in the DBGrid are posted to the database but are not displayed in the grid or maintained in its dataset and that you must get them back from the database. All the dataset components I have used maintain its copy of the data including all the changes that passed through it to the database. If you expect the data to be changed by triggers or another process, you may need to refresh the data. Then you will have to deal with the possibility that the current record position is lost, i.e. the current record was deleted in the database.
I would try using the Dataset.AfterPost event to initiate the refresh. And I would consider using a Timer to delay the refresh if strange things happen.