0
I’ve been racking my brain for two days and I can’t figure out the problem. I have an SQL (Tfdquery) statement written in the code that selects three fields from a table to display them in a Dbgrid. I don’t know what happens. The third field is never shown. And if I retained one of the two fields that appear in the Dbgrid of the SQL statement, it gives error at runtime, saying that the field is missing.
The SQL statement is as below:
Note: Dataset is a Tfdquery. When I started using it, I wrote the instruction below directly in the SQL Command tab of the Query Editor component, but without the aluNascimento field. Then I started to write the instruction in the code for execution in Runtime and added the aluNascimento.
Formsearch.DataSet.SQL.Text := 'SELECT idAluno, aluNome, aluNascimento FROM Students WHERE aluNome LIKE :Name';
The aluNascimento field does not appear in Dbgrid. And if I remove the idAluno or aluNome field from the SQL statement, the runtime error arises saying that the field is missing.
Someone’s been through something similar ?
Thanks for any help.
Good morning, see in the DFM of your form where is the dataset if there is any persistent reference of Fields (in dataset or grid). To see the DFM press Alt + F12.
– Andrey
Hello Andrey. Thank you for your reply. In Datamodule DFM is as below:
– BJA
Good morning, Andrey. YOU ARE RIGHT !!!. I opened the DFM of the Datamodule and there were constanting the two fields. Deletes the Tfdquery from the Datamodule, saved and put another Tfdquery component with the same "name". I checked the application and worked well, including already showing the third field. Thank you very much. Great hug.
– BJA