Forum > LCL

Weird Problems with TBufDataSet

(1/2) > >>

LeoBruno:
Hi Guys:

I'm Having weird problems with TBufDataset.

1. A Deleted record continues to show at a DBGrid, even thow the DataSet.IsEmpty returns true.

2. A Filtering with a string that should not retun anything, results on a correctly DataSet.IsEmpty, but one record still shows up at a DBGrid.

Any clues?

10x.

lainz:
In my previous experience with TBufDataset DataSet.IsEmpty is buggy.

LeoBruno:
The issue here is not DataSet.IsEmpty:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TViewNovaEntidadeRelacional.DeleteFK;begin  if not mtFKs.IsEmpty then  begin    mtFKs.Delete;  end;end;  
There is one record in the Dataset.

When calling the method above, as IsEmpty = false,  mtFKs.Delete Is Called.
But the DGBrid continues to show the record.

Calling the method again, doesn´t do anything, because now, DataSet.IsEmpty = true.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TViewNovaEntidadeRelacionalNovaFK.FiltraMtDestino;begin  mtColunasDestino.Filtered := false;  mtColunasDestino.Filter := '';   if Trim(edtFiltro.Text) <> '' then  begin    mtColunasDestino.Filter := 'NomeCampo = ' + QuotedStr('*' + edtFiltro.Text + '*');    mtColunasDestino.Filtered := true;  end;end;    
If I type X on the edtFiltro, It should result an Empty DataSet, because there is no record with the "X" character on the "NomeCampo" field, but the DBGrid shows the first record of the dataset and DataSet.IsEmpty = true.

So.....

I don´t think that the problem is DataSet.IsEmpty.




--- Quote from: lainz on September 03, 2022, 12:47:43 am ---In my previous experience with TBufDataset DataSet.IsEmpty is buggy.

--- End quote ---

Thaddy:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---DBGrid.BeginUpdate;// dataset codeDBGrid.EndUpdate;or something similar using one of the events.

GetMem:
Most likely a syncing problem inside TBufDataset, not related to the grid. Please try to refresh the BufDataset after filtering.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TViewNovaEntidadeRelacionalNovaFK.FiltraMtDestino;begin  mtColunasDestino.Filtered := false;  mtColunasDestino.Filter := '';   if Trim(edtFiltro.Text) <> '' then  begin    mtColunasDestino.Filter := 'NomeCampo = ' + QuotedStr('*' + edtFiltro.Text + '*');    mtColunasDestino.Filtered := true;    mtColunasDestino.Refresh; //add this line  end;end;  
If the ghost is still not disappeared, loop through the dataset and see if contains any data, like this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TViewNovaEntidadeRelacionalNovaFK.Button1Click(Sender: TObject);begin  mtColunasDestino.First;  while not mtColunasDestino.EOF do  begin    ShowMessage(mtColunasDestino.FieldByName('FIELD_NAME').AsString; //change FIELD_NAME    mtColunasDestino.Next;  end;end;  How many record do you see now?

Navigation

[0] Message Index

[#] Next page

Go to full version