misc Posted August 18, 2014 Posted August 18, 2014 Hello, i have a problem with a UniDBGrid with the following situation: Every time i make a SQL Call with "insert into" on my FireBird DB for the first time for a new user (of my cms, DB is not empty) and refresh the grid, the columns of my table are there but the entry is not. When i delete the entry (dbgrid is then empty) and make another call (insert into) and the same refresh method, the grid refreshes and i see the entry in the database. My Question is, is this the right way?: 1. SQL call: insert into... 2. Database.ExecuteDirect(..)... 3. DBGrid.DataSource.DataSet.Open; 4. DBGrid.DataSource.DataSet.Refresh; 5. DBGrid.Refresh; Do you have any other suggestions or ideas why it doesnt work on the first call? Quote
Administrators Farshad Mohajeri Posted August 18, 2014 Administrators Posted August 18, 2014 What is your uniGUI version? Quote
Administrators Farshad Mohajeri Posted August 18, 2014 Administrators Posted August 18, 2014 Where do you perform insert operation? In same session or in another session? Quote
Sherzod Posted August 19, 2014 Posted August 19, 2014 Hi Michael Schindler!If you are working with FireBird do you have the ability to use the components palette "InterBase"?Ie "TIBDatabase", "TIBTransaction", "TIBTable", "TIBQuery", "TIBUpdateSql" ...Best regards. Quote
adragan Posted August 19, 2014 Posted August 19, 2014 You have to do a Commit or better a CommitRetaining after the insert . After that do Close and Open for then Query that displays data. Refresh does not always work. In different DB engines there are different behaviors of the Refresh. TIBQuery, TUniQuery refreshes only the current reccord. That is it gets the id for the record and refetches the data. As you are after an insert, the client does not know the id of the new record and gets nothing. The Commit/Close/Open/Last sequence refetches all the records and goes to the last one which happens to be your insert. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.