how to make relative connection string

  • Thread starter Thread starter mrzoab
  • Start date Start date
M

mrzoab

hello........

I'm developing a client software. i'm now actually using an absolute
path for my connection string in my program abd this will be a problem
when i want to deploy it into another computer.

how do i solve this?

Thank you
 
Create a network share and reference it (assuming it's a desktop db). string
cn = @\\UseMSDEInstead\AccessDb.mdb; If it's a real client server db then
just use it's servername to reference it

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
add an element to your config file that contains the connection string.
Refer to it in code. Then, when you deploy, you (or your users, or a small
config app) can modify the config file to point to the proper directory.

Also, consider using a relative path. e.g. assuming you are using Access,
just point to the same directory as the app is in, or a subdirectory that
you will create during installation. Doesn't matter where the user picks...
you db will always be in the same (relative) location.

--- Nick
 
Hi,

If you know the relative path of the DB from your app you can build the
connection string from code. Also you can create a "config" option in the
app from where the client can locate the db, just use the OpenFileDialog for
this.


Cheers,
 
Back
Top