Dataset has no fields [SOLVED] lazarus / 16-Databases ---------------------------------------------------------------------- Dalgor · 2014-12-25 14:48 Hi all, I'm not an experienced coder and new with Lazarus. I set up two parallel sqlqueries on a form (separate sqltransaction, sqlquery, dataset and even dbconnection), i have two dbgrids to show the data. The connections are created basically according to the Sqldb tutorial. All components have the same properties set, i checked them many times. My problem is: the second dataset (roles) has two records, but no fields. Does anyone has any idea why is that? I spent days with debugging without success. procedure TUsersForm.RefreshUsers; begin   SQLTransactionGetUsers.Commit;   SQLQueryGetUsers.Close;   SQLQueryGetUsers.SQL.Text := 'select kezelo_id, login, nev, jelszo, jog_id, jog, ervenyes from SP_GET_USERS(' + IntToStr(MainForm.current_user_kezelo_id) + ');';   SQLQueryGetUsers.Open; end;  procedure TUsersForm.RefreshRoles; begin   SQLTransactionGetRoles.Commit;   SQLQueryGetRoles.Close;   SQLQueryGetRoles.SQL.Text := 'select jog_id, leiras from SP_GET_ROLES;';   SQLQueryGetRoles.Open;   DatasourceGetRoles.DataSet.Active:=true;   ShowMessage('Datasource GetRoles field count: ' + IntToStr(DatasourceGetRoles.DataSet.FieldCount));                    //output: 0   ShowMessage('Datasource GetRoles record count: ' + IntToStr(DatasourceGetRoles.DataSet.RecordCount));             //output: 2 end;                          The Firebird stored procedure (gives correct output in FlameRobin): alter procedure sp_get_roles returns (jog_id smallint, leiras varchar(50)) as begin    for select jog_id, leiras       from t_szerepkorok       into :jog_id, :leiras    do    suspend; end ^ Platform: Win7 Lazarus version: 1.0.13, FPC version 2.6.2 Firebird 2.5.2 embedded ---------------------------------------------------------------------- LacaK · 2014-12-25 18:23 Interesting! What value returns:   ShowMessageFmt(GetRoles FieldDefs: %d', [DatasourceGetRoles.DataSet.FieldDefs.Count]); ? ---------------------------------------------------------------------- Dalgor · 2014-12-25 19:26 Thanks for answering in such a short notice. GetRoles FieldDefs: 2 I forgot to mention but obviously the dbgrid shows up empty. ---------------------------------------------------------------------- LacaK · 2014-12-26 08:40 So it seems, that field definitions are fetched from Firebird correctly, but Fields are not created as expected. I have no idea where can be problem ? Can you reproduce it with latest version Lazarus + FPC ? If it is reproducible, can you upload here your testing code? ---------------------------------------------------------------------- Dalgor · 2014-12-27 22:29 I upgraded my environment (should have done that before asking) and the issue still exists (Laz 1.2.6 / FPC 2.6.4). I hope i included everything necessary (could not add  Firebird embedded's files because of the size constraint). The form in question is KifutStartUsersForm (bottom middle button on the main screen after login). There are remains of debugging attempts there, i left it as it is. Thanks. ---------------------------------------------------------------------- LacaK · 2014-12-28 17:27 Problem is that after:   SQLQueryGetRoles.Open you use:   SQLTransactionGetRoles.Commit; Commit by default closes all active dataset which are using given transaction. Use instead of Commit:   SQLTransactionGetRoles.CommitRetaining; You can try also move ShowMessages after your Commit and you will see, that there will be FieldCount=2 ---------------------------------------------------------------------- Dalgor · 2014-12-28 23:07 I put that commit there "just to make sure"... You were right, the data shows up now in the grid. Thanks for your help!