Novice VB Programmer requires help !
#1
Hi all,
I'm doing a spot of VB6 programming for an assignment for my HNC and need a pointer in the right direction ...
I'm doing a small database project which works fine no problems all finished ... however ... the database has to be included in the deployment package so it all works fine when I demonstrate the installation procedure and then go and demonstrate how it works etc. The simple question is ... how do I "hardcode" the database location as the application path so when the project is compiled it doesn't through a wobblie or when it's installed it won't say "database not found"
Simple question to a hardy VB programmer ... or is it not quite that easy ???
Thanx in advance
K
I'm doing a spot of VB6 programming for an assignment for my HNC and need a pointer in the right direction ...
I'm doing a small database project which works fine no problems all finished ... however ... the database has to be included in the deployment package so it all works fine when I demonstrate the installation procedure and then go and demonstrate how it works etc. The simple question is ... how do I "hardcode" the database location as the application path so when the project is compiled it doesn't through a wobblie or when it's installed it won't say "database not found"
Simple question to a hardy VB programmer ... or is it not quite that easy ???
Thanx in advance
K
#2
Hi Kev.
First off, I haven't done any serious VB for a few years now (I'm not a programmer to start with and all my recent work is in Access 97 or 2000).
Have you looked at the APP Object? I don't know if you still get APP in VB6 though!
IIRC, APP.Pathname returns the path to the EXE file of your program as it is being run. Thus, you could use :
APP.Pathname & "MyDB.MDB" to reference your DB
Any good?
Cheers,
Chris.
[This message has been edited by ChrisB (edited 30 November 2000).]
First off, I haven't done any serious VB for a few years now (I'm not a programmer to start with and all my recent work is in Access 97 or 2000).
Have you looked at the APP Object? I don't know if you still get APP in VB6 though!
IIRC, APP.Pathname returns the path to the EXE file of your program as it is being run. Thus, you could use :
APP.Pathname & "MyDB.MDB" to reference your DB
Any good?
Cheers,
Chris.
[This message has been edited by ChrisB (edited 30 November 2000).]
#4
try putting all the required files in a single folder, then change alter any pathnames in your code (or in the object navigator) to use this path. i think with vb if u use the same folder, you can leave out the top directory details as long as u specify a filename .
ps this is all from memory so sorry if it's not 100%
ps this is all from memory so sorry if it's not 100%
#5
Hi Kev
Without knowing how you are opening the database ( ADO / Jet / etc ) I could not comment on specifics.
1.In the Package and deployment Wizard try including the MDB and tell it where to put it.
or try
2.Putting the location in the registry ( use SaveSetting ) and then retrieving the registry entry ( Use GetSetting )just before opening the DB.
Export the registry file and include it in the Package and Deployment wizard.
You can then tell it to update the registry on installation.
Just make sure the Database exists in the new location.
Hardcoding is not the way to go
Hope that helps
Without knowing how you are opening the database ( ADO / Jet / etc ) I could not comment on specifics.
1.In the Package and deployment Wizard try including the MDB and tell it where to put it.
or try
2.Putting the location in the registry ( use SaveSetting ) and then retrieving the registry entry ( Use GetSetting )just before opening the DB.
Export the registry file and include it in the Package and Deployment wizard.
You can then tell it to update the registry on installation.
Just make sure the Database exists in the new location.
Hardcoding is not the way to go
Hope that helps
#7
Wow ..
Cheers all, thanks for all the tips, looks like I'll have a few hours this weekend to try a few of these out ....
Neil - I'm using "Jet" and setting the databasename property ie C:Ski_Liftles trois vallees.mdb and it works fine, when I build the deployment package I include it and it sets the path as the app path but if I try and change the property to app path it won't compile ??
Still I'll have a go this w/e and if I need any more help ........
Thanx all
K
Cheers all, thanks for all the tips, looks like I'll have a few hours this weekend to try a few of these out ....
Neil - I'm using "Jet" and setting the databasename property ie C:Ski_Liftles trois vallees.mdb and it works fine, when I build the deployment package I include it and it sets the path as the app path but if I try and change the property to app path it won't compile ??
Still I'll have a go this w/e and if I need any more help ........
Thanx all
K
Trending Topics
Thread
Thread Starter
Forum
Replies
Last Post
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM