Working with ClientDataSets裡是這麼寫的:
If you are using a ClientDataSet component and you get an Access Violation when exiting the application, you need to add the DBClient unit in the application uses clause before IWMain.
The reason for the access violation is that if DBClient is not included in project file uses clause, it's internal interfaces are freed before all sessions are closed and when IW closes it's sessions it will try to free ClientDataSet component, and you will get the access violation.
When DBClient is placed before IWMain IW will free sessions before DBClient interfaces are freed.
這章節在描述TClientDataSet可能會在Session釋放前就先被清除(Freed),然後在Session要釋放時又再被釋放一次,進而發生 Access Violation。

解決的方法就是在 IWMain 前的 uses 加入 DBClient,讓釋放的順序正確,Access Violation的問題才能獲得解決。



DataSnap REST + JS framework = full stack development (CHT)

ExpressWeb Framework, IntraWeb, UniGUI, Raudus, Elevate Web Builder, Kitto, Delphi MVC Framework... Delphi 這麼多 Web Solution 中,你用過哪幾種? ...