Delphi - Grid does not display all fields of the SQL statement

0

I've been warming my brains for two days and I do not discover the problem. I have a SQL statement (TFDQuery) written in the code and it selects three fields from a table to display them in a DBGrid. I do not 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 runtime error saying that the field is missing.

The SQL statement is as below:

Note: DataSet is a TFDQuery. When I started using it, I typed the statement below directly into the SQL Command tab of the component's Query Editor, but without the aluNasurement field. I then wrote the statement in the code for runtime and added the aluNascimento.

FormSearch.DataSet.SQL.Text: = 'SELECT idAluno, aluName, aluNascimento FROM Students WHERE aluName LIKE: Name';

The aluNasurement field does not appear in the DBGrid. And if I remove the idAluno or aluName field from the SQL statement, the runtime error appears saying that the field is missing.

Has anyone ever had anything similar?

Thanks for any help.

    
asked by anonymous 12.02.2018 / 00:04

2 answers

0

Good morning, as commented above, there may be persistent fields in the dataset . One way to check is to check in your form's DFM (where < in> dataset ) if there is any persistent reference to fields (in the dataset or grid). To view the DFM press the Alt + F12 key. If persistent fields are found, simply remove them (preferably by normal means, by finding the fields visually).

    
12.02.2018 / 16:58
0

There are several possibilities for the field not to appear. Between them: 1) The field object is invisible, 2) The dataset has field objects, but not that of the fields editor, 3) dbgrid has column objects, but not the column of that specific field.

    
12.02.2018 / 00:12