Is it a standard windows setup project?
If so you have to use one of the inbuilt variables to get your relative location or have a field that gets filled in by the user when they install. You can assign a variable/name to the field and use this variable in a custom action to modify the config file where you store your database connection string.
Google for "setup and deployment" and you'll get links like
Maybe a setup and deploy tutorial like http://msdn.microsoft.com/en-us/library/d9k65z2d%28VS.80%29.aspx
] might help