开发者

Re-Embedding Sqlite Database file into the same Executable

开发者 https://www.devze.com 2023-03-21 07:31 出处:网络
I\'m Creating Win Form application ,I\'m adding a Empty Sqlite Database file having Tables in it as embedded data开发者_运维百科 source. on run time i extract Database file into application path and I

I'm Creating Win Form application ,I'm adding a Empty Sqlite Database file having Tables in it as embedded data开发者_运维百科 source. on run time i extract Database file into application path and INSERT THE VALUES into the TABLE of that Database file. On Closing the application again i have to update or replace Database File into Executable. Is it possible ,if so how to do that.


I'm not sure if I understand the question correctly. If you are trying to re-write to the same exe you are running this is NOT possible. Windows locks code files that are in use so that they can't change. Additionally, it is not advisable either, code and data should be separate.

If you are trying to update another resources executable (that is not currently running), I don't know how to do that programatically (See this thread here for more info How do I replace embedded resources in a .NET assembly programmatically?) but if your program has access to the Visual Studio Compiler tools (which it probably doesn't) you can disassemble and reassemble the executable. See here: http://fortheloveofcode.wordpress.com/2007/09/24/change-resources-inside-assembly/.


Why not just store it in application folder? Or maybe user's AppData if you don't want to show it?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号