Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 20th, 2005, 02:50 PM
iacook28 iacook28 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 iacook28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 23 sec
Reputation Power: 0
Path to database

I am packaging and deploying my first VB6 app.

I will be installing the app on a remote server and don't want to have to redefine the path to my database in all the adodc objects I used. Is there a way of having the database generically always be in the same path as the application itself so that I don't have to change all of these before running the program at my client site.

Hope this makes sense.

Kindest regards


Ian Cook

Reply With Quote
  #2  
Old January 20th, 2005, 03:27 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
You can just use the Server.MapPath("dbName.mdb").

Reply With Quote
  #3  
Old January 20th, 2005, 04:07 PM
iacook28 iacook28 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 iacook28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 23 sec
Reputation Power: 0
Path to Database

Quote:
Originally Posted by Memnoch
You can just use the Server.MapPath("dbName.mdb").


Sorry,

This is all pretty new to me. How and where to I use that.

Thanks again

Ian

Reply With Quote
  #4  
Old January 20th, 2005, 04:13 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
In your connection string to connect to the database.

Reply With Quote
  #5  
Old January 20th, 2005, 04:14 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
If you are using ADODB data bound controls, you'll need to modify all of them.

I don't recommend using the data bound controls, they are very limiting.

Reply With Quote
  #6  
Old January 20th, 2005, 11:32 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 32 m 23 sec
Reputation Power: 180
Server.Mappath is an asp object not available to VB6.

app.path will give you the path to your current application directory. So if your mdb is in some folder off you main app folder, it's path would be something like

mdbPath = app.path & "\somefolder\some.mdb"

Then use that relative path in any db connection code. Unlike Memnoch, I use databound controls all the time.

If you're using an ADODC or something similar for your recordset, you can easily add some Form_Load or Form_Activate code that sets the recordsource from code rather than design time.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #7  
Old April 27th, 2005, 03:53 AM
Marc Van Beeume Marc Van Beeume is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 6 Marc Van Beeume User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 53 sec
Reputation Power: 0
Hi

I read in these posts that "if you're using an ADODC or something similar for your recordset, you can easily add some Form_Load or Form_Activate code that sets the recordsource from code rather than design time."

This is a problem i encounter now. The databound control already needs the result recordset even if you put the connection definition in the initialize statement.

Can someone put an example of how to do it

Kind regards and thanks in advance

Marc

Reply With Quote
  #8  
Old April 28th, 2005, 09:11 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 32 m 23 sec
Reputation Power: 180
If you have an adodc control, leave the connection string and recordsource blank in design time, then in some code use something like:

adodc1.ConnectionString = <your connection string>
adodc1.RecordSource = <your sql string>
adodc1.refresh

Then you can bind the populated adodc to other controls in subsequent code.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Path to database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway