Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1463

VB6 Restoring NWind.db InMemory from ResourceBytes (without touching the FileSystem)

$
0
0
Sometimes there's the problem, to ship your App with a less than simple store, which contains "structured static Data" (e.g. a small catalogue-DB or a DB which contains the word-archives for your small spellchecker or something like that)...

If possible you will have the additional requirement, to ship it within your Executable (or Dll or OCX) - directly as a Binary-Resource (a "compiled into" ByteArray if you want).

Ok, one could do that e.g. with a JET-DB - (and compress and encrypt the FileContent into Bytes) - but in this case you'd have to "decrypt and unpack" into the Filesystem, to be able to use your DB-Data from the compiled-in ResourceBytes.

That last step (the FileSystem-Placement) is often not wanted - but the comfort of a DB (fast queries, joins, filters etc.) shall also remain possible - OK - with SQLite as the JET-alternative one can fullfill that need, since it allows true InMemory-Databases.

The following Demo contains a small example which is acting on NWind.db-content and performs both directions:
  1. the "packing-process" from a filebased DB -> ending up with compressed and RC4-encrypted ResourceBytes
  2. and the opposite direction (decryption/decompression/InMemory-DB-Creation from a plain ByteArray)

The Sources depend on the vbRichClient5-Project-Reference (Download available here: http://vbRichClient.com):

Here comes a ScreenShot:



And here the Project-Download-Link:
http://vbRichClient.com/Downloads/SQ...omResource.zip


Have fun with it...

Olaf

Viewing all articles
Browse latest Browse all 1463

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>