Forum > Databases

Set Recordnumber in DBgrid

(1/1)

madref:
With the following code you can see what record is selected in the dataset.

--- 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.DataSource.DataSet.RecNoHow can I go to that recordnumber after a refresh without using the following code:

--- 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";}};} ---Q_Evaluaties.Locate('ID;TBL', VarArrayOf([Save_ID, Save_RL]), []);

madref:
Any one???

cdbc:
Hi
IIRC TDataset implements 'Bookmarks', as I remember they're easy to use...
Try looking it/them up, they've been there since Delphi 2
edit: Just looked it up in 'TDataset', it's a property of TDataset, of type 'TBookmark'; you set a local/tmp variable equal to it -> do your refresh -> then set it back again:
--- 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";}};} ---var tmpBkMrk: TBookmark;begin  ...  tmpBkMrk:= myDataset.Bookmak;  myDataset.Refresh; // or something like that  myDataset.Bookmark:= tmpBkMrk;  ...end; HTH
Regards Benny

Navigation

[0] Message Index

Go to full version