Hi there. I am working on a large project (for me,
anyway) where I am creating many connections/adapters to
an Access database.

I started using the IDE to create all my connections and
adapters which was very convenient and easy to update (I
like just checking boxes and removing entries when I
change the database). Now I am getting ready to deploy
the project and I am wondering what the best method is
for letting the connection string know where the database
will be on the machines I deploy the project to.

I'm wondering what the best way (or what your favorite
way) to deal with this problem is. All of these options
involve using Application.StartUpPath and looking for my
program folder and then creating a string where my data
folder will be. For example... while debugging if my
StartUpPath is:
C:\Adam\bin\debug I do an indexof search on the Startup
path and look for "Adam\" then add "\data\adam.mdb". This
should work when the program is deployed in
say: "C:\Program Files\Adam" . My only concern is that
the user may not accept the "Adam" folder and may name it
something else in which case my indexof search will be
useless. Is there a better way at getting at the path?

As for dealing with all my adapters and connections. I'd
like to do this only once so I'm wondering what the best
method would be:

option 1:
get rid of all the generated code and code by hand using
commandbuilder for the update,insert and delete logic.

option 2:
copy the update,insert and delete commands that Visual
Studio created for me and delete the objects from the
designer. Code the adapter by hand and instead of using
commandbuilder use the copied code which I had deleted.

option 3:
Is there some way to just use the code generated by
visual studio and point it to the folder where the access
database resides? When I look at the code that the
connection object has created it seems to be hardcoded to
the directory on my machine.

Sorry for the length of this post but it is my first.
Thanks In Advance.
Adam.

Re: Deployment,ADO.net and paths (what's best/preferred method?) by William

William
Wed Jan 07 22:36:04 CST 2004

A configuration file should do it for you...
http://www.knowdotnet.com/articles/configfiles.html
"Adam in LA" <westadam@aol.com> wrote in message
news:055a01c3d586$0cba3650$a401280a@phx.gbl...
> Hi there. I am working on a large project (for me,
> anyway) where I am creating many connections/adapters to
> an Access database.
>
> I started using the IDE to create all my connections and
> adapters which was very convenient and easy to update (I
> like just checking boxes and removing entries when I
> change the database). Now I am getting ready to deploy
> the project and I am wondering what the best method is
> for letting the connection string know where the database
> will be on the machines I deploy the project to.
>
> I'm wondering what the best way (or what your favorite
> way) to deal with this problem is. All of these options
> involve using Application.StartUpPath and looking for my
> program folder and then creating a string where my data
> folder will be. For example... while debugging if my
> StartUpPath is:
> C:\Adam\bin\debug I do an indexof search on the Startup
> path and look for "Adam\" then add "\data\adam.mdb". This
> should work when the program is deployed in
> say: "C:\Program Files\Adam" . My only concern is that
> the user may not accept the "Adam" folder and may name it
> something else in which case my indexof search will be
> useless. Is there a better way at getting at the path?
>
> As for dealing with all my adapters and connections. I'd
> like to do this only once so I'm wondering what the best
> method would be:
>
> option 1:
> get rid of all the generated code and code by hand using
> commandbuilder for the update,insert and delete logic.
>
> option 2:
> copy the update,insert and delete commands that Visual
> Studio created for me and delete the objects from the
> designer. Code the adapter by hand and instead of using
> commandbuilder use the copied code which I had deleted.
>
> option 3:
> Is there some way to just use the code generated by
> visual studio and point it to the folder where the access
> database resides? When I look at the code that the
> connection object has created it seems to be hardcoded to
> the directory on my machine.
>
> Sorry for the length of this post but it is my first.
> Thanks In Advance.
> Adam.
>