Solved

creating or copying Database(Access) via setup or by algo 4 1st time?

Posted on 2004-04-01
7
208 Views
Last Modified: 2010-04-17
given-> i have develped a package in visual basic & its database is in access 2000. Now i have prepared its setup but while i run the package after its installation via setup it shows me that required database named 'Mis.mdb' is not found.

For that i have to manually copy it (mid.mdb) into the current path of application say '.\database\mid.mdb' . (don't want this solution)

problem is ->
But i want it to be copied via my application's first time setup. i mean i want to happen automatcially so that it can hidden from its user.

better solution if algo given
Thankx
0
Comment
Question by:tomerps1
  • 3
7 Comments
 
LVL 6

Expert Comment

by:mmusante
ID: 10738889
if you use DAO you can create your DB using the CreateDatabase method ...

Dim wrkDef As Workspace
Dim dbsNew As DATABASE

Set wrkDef = DBEngine.Workspaces(0)

If Dir("MyDB.mdb") <> "" Then Kill "MYDB.mdb"

Set dbsNew = wrkDef .CreateDatabase("MyDB.mdb", dbLangGeneral, dbEncrypt)

... after that you have to create by code all your DB tables using execute method

dbsNew.execute "CREATE TABLE ...
0
 

Author Comment

by:tomerps1
ID: 10738954
But My Dear Friend
 
it's very tedious. I have around 180 tables. Many Of them are filled up with 1000- 20000 records (default supplied with database) with many columns. is there any other way ? i am using 'adodb' to access ACCESS.
0
 
LVL 6

Accepted Solution

by:
mmusante earned 50 total points
ID: 10738988
OK ... The easy way ...
Make an installation package (VB has an'utility to do this) and add your MDB to the package (I suggest in the application path)

... the drawback ...
If somebody uninstall your software he loose his data

... the solution ...
Make a copy of original DB on first execution and work on it (uninstall will not delete this file)

If Dir(App.path & "\MyDB2.mdb") = ""  then
    shell("Copy " & app.path & "\MyDb.mdb " & app.path & "\MyDB2.mdb ")
endif
0
 

Expert Comment

by:rhowella
ID: 10745962
Recreate your installation package and include your database in the package. When the package prompts you to mark "SHARED FILES", mark the checkbox your database, this way, even if the user uninstalls the program, the database can be preserved. during uninstallation the user has the option to keep/delete the shared file.
0
 
LVL 6

Expert Comment

by:mmusante
ID: 10755258
Yes rhowella! it's right ... if the user knows HOW MUCH IMPORTANT IS the mdb file ... I prefer do not risk.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Software installation of SCCM client 14 135
VB.NET 2008 Winforms Signing 13 33
Dot Net 4.6.1 installation fails on W2012 R2 server 14 40
troubleshoot a python script 8 25
Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question