Notices
Non Scooby Related Anything Non-Scooby related

Novice VB Programmer requires help !

Thread Tools
 
Search this Thread
 
Old 30 November 2000, 06:34 PM
  #1  
Kev
Scooby Regular
Thread Starter
 
Kev's Avatar
 
Join Date: Jul 1999
Posts: 711
Likes: 0
Received 0 Likes on 0 Posts
Question

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
Old 30 November 2000, 09:41 PM
  #2  
ChrisB
Moderator
 
ChrisB's Avatar
 
Join Date: Dec 1998
Location: Staffs
Posts: 23,573
Likes: 0
Received 0 Likes on 0 Posts
Thumbs up

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).]
Old 01 December 2000, 12:45 AM
  #3  
Bal
Scooby Regular
 
Bal's Avatar
 
Join Date: Jun 2000
Posts: 271
Likes: 0
Received 0 Likes on 0 Posts
Post

Try app.Path and you get the installed location of the .exe then just build up the string.
Old 01 December 2000, 01:21 AM
  #4  
CC
Scooby Regular
 
CC's Avatar
 
Join Date: Aug 2000
Posts: 909
Likes: 0
Received 0 Likes on 0 Posts
Post

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%
Old 01 December 2000, 08:24 AM
  #5  
Neil Micklethwaite
Scooby Regular
 
Neil Micklethwaite's Avatar
 
Join Date: Dec 1998
Posts: 1,046
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 01 December 2000, 09:28 AM
  #6  
GranTurismo
Scooby Regular
 
GranTurismo's Avatar
 
Join Date: Apr 1999
Posts: 882
Likes: 0
Received 0 Likes on 0 Posts
Post

I cant help but try posting this on
Old 01 December 2000, 06:33 PM
  #7  
Kev
Scooby Regular
Thread Starter
 
Kev's Avatar
 
Join Date: Jul 1999
Posts: 711
Likes: 0
Received 0 Likes on 0 Posts
Thumbs up

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
Old 03 December 2000, 06:34 PM
  #8  
Kev
Scooby Regular
Thread Starter
 
Kev's Avatar
 
Join Date: Jul 1999
Posts: 711
Likes: 0
Received 0 Likes on 0 Posts
Thumbs up

Cheers folks ..

Got it working a treat and you were all so right it was easy .... mega chuffed

Thanks all

K
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Abx
Subaru
22
09 January 2016 05:42 PM
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM
FuZzBoM
Wheels, Tyres & Brakes
16
04 October 2015 09:49 PM
buckerz69
Wanted
2
03 October 2015 09:54 PM
Nick_Cat
Computer & Technology Related
2
26 September 2015 08:00 AM



Quick Reply: Novice VB Programmer requires help !



All times are GMT +1. The time now is 09:57 PM.