Issue with Data Persistence in TUniQuery when Using TMSFNCGrid

Dear Support Team,

I am encountering an issue with data persistence in TMSFNCGrid when using TUniQuery with SQL Server. My approach involves calling the LoadAllDataAndDisconnect procedure to load data into the grid. This setup is necessary for utilizing features like grouping and filtering. However, I'm facing a problem where the data disappears from the grid once I free the TUniQuery, although the grid still retains the correct column count matching the fetched table.

Interestingly, when substituting TUniQuery with TFDQuery and applying the same method, the grid retains the data even after freeing the query.

Additional context:

  • I'm unable to access data through events without using LoadAllDataAndDisconnect; the grid fails to fetch the data otherwise.

  • I have included a demo to illustrate the issue. Please ensure that the uniConnection is connected to your database for testing. I used AdventureWorks2019 for this purpose.

Here's the demo link: Download Link

Thank you for your attention to this matter. I look forward to your guidance on resolving this issue.

Best regards

When freeing the dataset, it potentially gives a notification to the adapter to reinitialize and remove all data. This is built-in as when the connection is lost, it's no longer valid data in the grid even though the dataset active property is set to false. the connection to the dataset needs to remain. Since you are using the LoadAllDataAndDisconnect, alternatively, you could use

while not DataSet.Eof do
//fetch data & load in the grid directly


and don't use the grid database adapter.

We'll investigate if we can apply an improvement to disconnect the dataset and retaining the data.