how can i change the path of my database, because if i move my program to another computer it complains of database error.
i use this code to add record to the database.
adodc1.recordset. addnew
please assist
thanks

Look in the properties of the ADODC (Database or connectionstring I think?). Copy it, paste it, see the path? Now, remove that setting from the properties box and put it in form load as it is. Make sure it still works. Now you should be able to figure out how to change it.

Good Luck

It is always better to store the DB file in the application path and set the property of the control using code in the form load event.

how can i change the path of my database, because if i move my program to another computer it complains of database error.
I think you want to set the database path :
Normally i am using this code :
" Database name = App.path & "\Databasename.mdb"
If you connect like this , then it only demands your database with the application.

how can i change the path of my database, because if i move my program to another computer it complains of database error.
it seems it cannot locate the path of the database so how can i change the path when i move my program to another system
i use this code to add record to the database.
in the form load event procedure
adodc1.recordset. addnew
to delete record i use
adodc1.delete
please assist
thanks

Vineeth K,

You can't just move your program. You need to create an installable package. The PDW that comes with VB is a bit outdated but will work for some systems. For Vista it will need to be run as administrator or better yet download either inno or windows installer from MS.

Next up, where to put your data on vista...

See post #5 and the attachment.

http://www.vbforums.com/showthread.php?t=558385

you should be able to modify that code to find the special folders

dammysky,

From the properties window copy the connection string for the ADODC. Then in the forms load use the same property and paste the string there (ADODC1.ConnectionString = "?"). If useing Data1 then it would be Data1.Database = "?". That is the property you would need to change.


Good Luck to all

You can't just move your program. You need to create an installable package. The PDW that comes with VB is a bit outdated but will work for some systems. For Vista it will need to be run as administrator or better yet download either inno or windows installer from MS.

I think you are thinking in another way ....I mean just use code App.path to connect database or load any file.Before that please copy your files to the application directory [ i think he missed that !! ] .
If you use that then when you moved the program or installed the program : - When the program run then it will look for the file only in the applications directory." Don't forget to add those files during installation package development " .
And
I am using install packages for installing or moving to another computer.

As everybody above already stated, copy the database to the same file you are using on the pc where you started the application. It seems that you are talking about just testing on another pc and not installing. Vineeth is quite correct in using App.PAth for easier testing. When installing, make sure that your data connection path is the same as to where the database will be installed to.

This article has been dead for over six months. Start a new discussion instead.