|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Please some one give me a clear answerI can't seem to find the answer to this question any where.
Lets say I make a program with 2 forms. Each with a combo box or txt box...what ever....that is attached to an access database. I want to sell my program to joe schmoo. Now the program works fine on my puter because the path of C:/MyProgram is a valid path BUT joe schmoo needs to install the program and the database. NOW how do I get that path of c:/MyProgram to change to where ever joe installs it on his puter. I cant believe the troble I have had finding the answer to this question...as if I am the only one in the world who wants to deploy a program with a database attached.....UGH Thanks ![]() |
|
#2
|
|||
|
|||
|
Is your application in c:/MyPrograms ?
|
|
#3
|
|||
|
|||
|
This is just theoretical, but yes, lets say my Database is at C:/MyApplication
As is teh application itself. when you buy this applicaton from me my connection string has the path of c:/MyApplication.MyDB.MDB for the database. Lets say you install the application along with the database...which is packaged with the application......at c/YourApplication The program will not connect to the database because the connection string is set to my path name not yours. There must be some way to change it or something Thanks |
|
#4
|
|||
|
|||
|
If your database is in the same folder where your application executable is, then dont hardcode your database path while connecting the string.
a) Instead, get the path of your application using:- Dim Str1 as string = Path.GetDirectoryName(Application.ExecutablePath) concatenate the string with ur database like this:- Str1 = Str1 & "\MyDatabase.mdb" and then connect with this Str1. b) While making deployment project, make sure the database is in the same folder where ur application executable is. It will ask for the path when Joe installs ur application. wherever he installs ur application, it also puts ur database there. And conncects to the database using the Str1 string. Try this one... Regds, pmuk |
|
#5
|
|||
|
|||
|
This is Not Working For ME!!!
When I type this line, the "Path" is underlined:
Path.GetDirectoryName(Application.ExecutablePath). Do I need to import something? |
|
#6
|
|||
|
|||
|
Yes, you need to this:
Import system.IO Sorry for not mentioning that previously...Hope this helps now. |
|
#7
|
|||
|
|||
|
If the database is in the app folder on a users machine,
how does a 2nd user connect to the database. Paullie |
|
#8
|
|||
|
|||
|
That's when you would want to put the database on a server and both computers access it on the server.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > data source during deployment |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|