Working on project on 2 PC's

  • Thread starter Thread starter Gary Paris
  • Start date Start date
G

Gary Paris

I am working on a project which I have on my desktop. The project and data
reside on the D: drive
Sometimes I copy the project over to the laptop which is on the C: drive.
Each time I have to edit the following code to put the proper Drive letter
in.

g_DataLocation = "D:\Test\Test.mdb"
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
g_DataLocation


Is there a way that I can have the project go to the correct drive without
having to physically change the D: to C: ?

I saw a application.config file but if I copy everything, that gets replaced
also.

Thanks,

Gary
 
Gary:

Your problem extends well beyond working on the project. What are you going
to do when you deploy the application to other computers?

The best thing to do is to keep the location of the database in the
application configuration file. If you can't use a path reference, create an
ODBC DSN entry in Administrative Tools and only store the DSN name in the
application configuration file. You will then need to create the same DSN on
all machines that will run the app.

Alternatively, (although this would only work reliably for development) you
can access the database using a relative path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top