简体   繁体   English

为什么 Delphi 崩溃时数据库控件的数据源消失

[英]Why do datasource of database-controls dissapear when Delphi crashes

I'm using Delphi 10.4.1 Enterprise and wrote a VCL program using an SQLite database.我正在使用 Delphi 10.4.1 Enterprise 并使用 SQLite 数据库编写了一个 VCL 程序。

As I suspect a OneDrive issue, I mention that the source code folder is part of the zone managed by OneDrive.由于我怀疑是 OneDrive 问题,我提到源代码文件夹是 OneDrive 管理的区域的一部分。

At times, whilst debugging, my Delphi program hangs for unknown reasons, and Delphi quits without further notice.有时,在调试时,我的 Delphi 程序由于未知原因挂起,并且 Delphi 退出,恕不另行通知。 Whenever this happens, the connections between the MainForm and the DataModule (DM1) are lost: in the Object Inspector of the MainForm, all DataSource assignments, ie connections to DataSources in the DataModule, are gone.每当发生这种情况时,MainForm 和 DataModule (DM1) 之间的连接就会丢失:在 MainForm 的 Object Inspector 中,所有 DataSource 分配,即与 DataModule 中的 DataSource 的连接都消失了。 Moreover, when I reload the program, there is the error message此外,当我重新加载程序时,出现错误消息

Access violation at address 500C3553 in module 'rtl270.bpl'.模块“rtl270.bpl”中地址 500C3553 的访问冲突。 Read of address 00000008读取地址 00000008

Code-checking gives no errors, but when compiling the following message/request appears:代码检查没有错误,但在编译时出现以下消息/请求:

Module 'MainForm' links to module 'DM1' which cannot be found in the current project.模块“MainForm”链接到当前项目中找不到的模块“DM1”。 Do you wish to remove/redirect the links to another module?你想删除/重定向到另一个模块的链接吗?

The weird thing is that the DataModule design form in the IDE can no longer be made visible, only its code remains.奇怪的是,IDE 中的 DataModule 设计形式不再可见,只剩下它的代码。 Therewith, from within the MainForm the DataModule neither is visible, since dropdowns in the DataSource connectors of the DB-controls remain empty.因此,在 MainForm 中,DataModule 都不可见,因为 DB 控件的 DataSource 连接器中的下拉列表保持为空。 Last, but not least, when I try to save the MainForm, it says:最后但并非最不重要的一点是,当我尝试保存 MainForm 时,它说:

Module "*MainForm" references another module and cannot be saved until DM1 is loaded模块“*MainForm”引用了另一个模块,在加载 DM1 之前无法保存

Whatever I tried to get it back to normal, it was unsuccessful.无论我试图让它恢复正常,它都没有成功。 However, in the OneDrive root folder, I see a file named " .849C9593-D756-4E56-8D6E-..etc.. ", which seems to be associated with my program, because of its file date.但是,在 OneDrive 根文件夹中,我看到一个名为“ .849C9593-D756-4E56-8D6E-..etc.. ”的文件,由于其文件日期,它似乎与我的程序相关联。 It can only be deleted or modified when I close OneDrive, but it revives after restart.只能在关闭 OneDrive 时删除或修改,但重启后会恢复。

I am stuck, for many days already.我被卡住了,已经很多天了。

Does anyone have an idea what is going on, and can give me a hint on how to proceed?有谁知道发生了什么,并且可以给我一个关于如何进行的提示?

I found out what has caused the Access Violation that showed up after I tried to bring the datasource connections back in place.在我尝试将数据源连接恢复到位后,我发现了导致访问冲突的原因。 I did that by editing the DFM-file of the Mainform, rather than direct in the Object Inspector.我通过编辑 Mainform 的 DFM 文件来做到这一点,而不是直接在 Object 检查器中。 I normally do editing in dfm-files, but adding lines with datasource assignments appears not to be allowed.我通常在 dfm 文件中进行编辑,但似乎不允许添加带有数据源分配的行。 This was quite a tough lesson for me.这对我来说是一个相当艰难的教训。 I am happy to have the program running again, Thank you all for your time.我很高兴该程序再次运行,谢谢大家的时间。 @Remy in particular.特别是@Remy。

Thanks, JGMS谢谢,JGMS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM