|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
You can just use the Server.MapPath("dbName.mdb").
|
|
#3
|
|||
|
|||
|
Path to Database
Quote:
Sorry, This is all pretty new to me. How and where to I use that. Thanks again Ian |
|
#4
|
||||
|
||||
|
In your connection string to connect to the database.
|
|
#5
|
||||
|
||||
|
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. |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
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. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Path to database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|