Ian Branch 127 Posted April 20, 2023 (edited) Hi Team, Win 11, D11.3.1. I experienced this a while ago, pretty sure I asked the question here, but I don't recall ifthere was a resolution. Twice in the past week two different Apps have had their DB components lose their connection to their datasource. As in the Datasource entry in the components is empty. All of them. I have had to reconnect all the components to their datasource. Oh the pain!! It isn't just one datasource either. There are a couple of datasources involved that get lost. Has anybody else experienced this? Does anybody have any suggestions as to what might be causing it? Regards & TIA, Ian Edited April 20, 2023 by Ian Branch Share this post Link to post
programmerdelphi2k 237 Posted April 20, 2023 tip: do the search in your "Profile" and try find it! big tip: I think that you need just "created another project" and migrate your code/components to new forms (not complete old-Forms)!!! think about Share this post Link to post
SwiftExpat 65 Posted April 20, 2023 3 minutes ago, Ian Branch said: have had to reconnect all the components to their datasource. Oh the pain!! Version control that file and commit often. Then you can merge the changes or just go back to the old version of the dfm. At least this will save the pain of resetting those connections. I do not experience the problem. Share this post Link to post
Ian Branch 127 Posted April 20, 2023 (edited) Tks P2k. I went to my Profile but couldn't find any search functionality. @Uwe Raabe said - "This can also happen when the missing DataSource is not located at the same form/frame as the DB components and the IDE fails to open the datamodule (or wherever this datasource resides) for whatever reasons. I had similar experiences with actions located in a datamodule. If by any chance that datamodule shares its name with one of the IDE internal ones (including those in 3rd party modules) that can be the cause of breaking the linkage." Question - If the Form was opened on its own, and not via the project, therefore the relevant datamodule is not present/loaded, would that cause the issue? Ian Edited April 20, 2023 by Ian Branch Share this post Link to post
programmerdelphi2k 237 Posted April 20, 2023 (edited) 1 minute ago, Ian Branch said: Question - If the Form was opened on its own, and not via the project, therefore the relevant datamodule is not present, would that cause the issue? only if you re-save it, I think! question: are you using "Automatic save" in tools options! Edited April 20, 2023 by programmerdelphi2k 1 Share this post Link to post
Ian Branch 127 Posted April 20, 2023 Just now, programmerdelphi2k said: only if you re-save it, I think! That is most often the case. Open just the form to make a quick edit and save it. Perhaps I should stop that practice.. 😉 Share this post Link to post
programmerdelphi2k 237 Posted April 20, 2023 (edited) I never use it! in last case, keep the "history files" to recover old saves! Edited April 20, 2023 by programmerdelphi2k Share this post Link to post
programmerdelphi2k 237 Posted April 20, 2023 other tip: use a GitHub (or other) to control your versions, then, always you'll have old saves! Share this post Link to post
Ian Branch 127 Posted April 20, 2023 1 minute ago, programmerdelphi2k said: other tip: use a GitHub (or other) to control your versions, then, always you'll have old saves! I do, but better I don't cause the issue to start with. Share this post Link to post
Fr0sT.Brutal 900 Posted April 21, 2023 IDE automatically removes datalinks if datasource is unavailable. Version control to save you from the pain of restoring links and you've to open forms with the project loaded. Or just assign datalinks at runtime Share this post Link to post
Ian Branch 127 Posted April 21, 2023 13 hours ago, Fr0sT.Brutal said: IDE automatically removes datalinks if datasource is unavailable. It could at least warn you and ask you if it should remove the links.... Share this post Link to post
Uwe Raabe 2058 Posted April 21, 2023 That sounds easier as it is. In the DFM the links are stored as texts (the name of the linked component). When the DFM is loaded the names are resolved to the actual instance. So after loading the names don't exist anymore outside the instance. Later when the DFM is saved, the instance names are written to the DFM. To achieve what you propose, each linked property needs a place to store the loaded name when the link cannot be resolved and restored when saved. Alas, this can get pretty tricky in the case when the link was not found and you want to deliberately remove it. If we step back and ask for a simple warning without the option to keep the missing links, that may be much easier to implement. Share this post Link to post
Ian Branch 127 Posted April 21, 2023 It can't hurt to ask... 🙂 https://quality.embarcadero.com/browse/RSP-41366?filter=-3 Share this post Link to post
Fr0sT.Brutal 900 Posted April 27, 2023 On 4/21/2023 at 11:49 PM, Ian Branch said: It could at least warn you and ask you if it should remove the links.... Yeah, just like it does with missing components and even their props Share this post Link to post