Put TSQLQuery.RefereshSQL some string, then delete it. You get error after calling TSQLQuery.ApplyUpdates in the Lazarus-IDE
Original Reporter info from Mantis: SunyD @soner-a
-
Reporter name: Soner
Original Reporter info from Mantis: SunyD @soner-a
- Reporter name: Soner
Description:
Let's assume you have working TSQLQuery with right select, delete, update, insert statements and you don't touched TSQLQuery.RefreshSQL statement.
When you set some string to TSQLQuery.RefreshSQL in Objektinspektor and delete it again, you will get "EDatabaseError: SQL statement not set". When you start the programm from Lazarus-IDE.
In the forms LFM-File the entry for TSQLQuery.RefreshSQL looks like:
RefreshSQL.Strings = (
''
)
When you delete from LFM-File this empty entry with text-editor then the error disappears.(Don't forget to delete projects-lib folder, there is copy of lfm-file)
Also calling:
SQLQuery1.RefreshSQL.Text:='';
in OnFormCreate-Event solves the problem.
I don't know if it component-streaming problem or TSQLQuery or Lazarus-Ide problem.
I use it with Firebird 2.5 Database.
My Lazarus: Version 1.6.3, 2016-11-21 SVN-Revision 53387
Steps to reproduce:
1.Build TSQLQuery with right select, delete, update, insert statements
You can use the example from this issue:
http://bugs.freepascal.org/view.php?id=31375
- Set TSQLQuery.RefreshSQL some string in Objektinspektor
- Now delete TSQLQuery.RefreshSQL with Objektinspektor
- Start the projekt with Lazarus.
- Edit some records save it, call TSQLQuery.ApplyUpdates.
- you will get "EDatabaseError: SQL statement not set"
- Close the programm open forms Lfm-File with any text editor and delete entry, between "...":
object SQLQuery1: TSQLQuery
....
RefreshSQL.Strings = (
''
)
...
and save it.
Delete in projects folder the sub-folder lib, there is old copy of lfm-file.
8.Now start start the programm from Lazarus, edit and save records. the error is no more error.
9. Instead of editing the lfm-file(7.), you can also set in OnFormCreate:
SQLQuery1.RefreshSQL.Text:='';
Additional information:
You can use the example from this issue:
http://bugs.freepascal.org/view.php?id=31375
Mantis conversion info:
- Mantis ID: 31378
- OS: Windows
- OS Build: 7
- Build: 2015/12/07
- Platform: i386-win32
- Version: 3.0.0
- Fixed in version: 3.1.1
- Fixed in revision: 35421 (#3bd8da04)
- Target version: 3.2.0