How to hide database

-

Development tool: Visual Studio 2005

Language: Visual Basic .NET

ISSUE: Package database into program

-

DETAILS:

I have a windows forms application that uses an Access Database. I am new to windows forms applications, so there is still a LOT for me to learn.

Currently the only way I can figure out how to map out the connection string for the database is to place the file on the users C: drive in the program folder of the application. So my connection string looks like "C:\Program Files\MyApplication\access_db\MyDB.mdb"

Then when I create the setup and deploy on an "end-user" machine, the setup creates that directory and places the file in that folder.

I am used to web development and we have the luxury of using "Server.MapPath("MyDB.mdb")" to create a dynamic connection to the database.

How can I package this database into the .exe and make it so that when the user installs the program, they cannot dig into their Program Files folder and get to the database? It is pretty important that the users cannot find thier way to this data.

--

Your help is appreciated,

KJAK

[1207 byte] By [kjak] at [2007-12-27]
# 1

bump...

Please... anybody that can help me with this?

kjak at 2007-9-3 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 2

Well, first of all, if securing the data is a high priority I'd recommend against using Access databases. My experience with them, which goes back to 1.0 days, is that they're difficult to secure reliably and are easy for users to get their hands on for whatever reasons they might have. You might want to consider other options if you can.

But, to get to your question, you can use My.Application.Info.DirectoryPath to get the directory where your application is located. You may also use My.Computer.FileSystem.SpecialDirectories to get other common folders where application data is stored.

FrankCarr at 2007-9-3 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...