Home All Groups Group Topic Archive Search About

Using Microsoft Access and Enterprise Library 2.0

Author
14 Apr 2006 7:09 PM
dhussong
I am attempting to use Visual Studio 2005 (Visual Basic) and the Enterprise
Library 2.0 Data Access Application Block with a Microsoft Access database. I
know the names of my Access databases but I don't know their location until
the user has started using the application. Therefore I cannot hardcode the
location into the app.config file as the Data Access Application Block seems
to need. So I have 2 questions:
1. Is it possible to use a relative path in the app.config file that will be
automatically replaced? For example, could I put in [AppDataPath] in the
app.config file as a placeholder and then replace it at runtime with
"C:\Documents and Settings\username\Application Data"?

2. If 1 above is not possible, is it possible to change the connection
string that is used by the DatabaseFactory.CreateDatabase() method so that I
can point it to my Access database?

Thanks in advance.

Author
21 Jun 2006 6:50 AM
Delphi
Hi dhussong
I worked with Enterprise Library Block 2003 v:1.1.0.
Here what i will do is read the dataconfiguration.xml from my application
and change the connection string and it is working. If you got any other
option pls let me know..

Michael George



Show quoteHide quote
"dhussong" wrote:

> I am attempting to use Visual Studio 2005 (Visual Basic) and the Enterprise
> Library 2.0 Data Access Application Block with a Microsoft Access database. I
> know the names of my Access databases but I don't know their location until
> the user has started using the application. Therefore I cannot hardcode the
> location into the app.config file as the Data Access Application Block seems
> to need. So I have 2 questions:
> 1. Is it possible to use a relative path in the app.config file that will be
> automatically replaced? For example, could I put in [AppDataPath] in the
> app.config file as a placeholder and then replace it at runtime with
> "C:\Documents and Settings\username\Application Data"?
>
> 2. If 1 above is not possible, is it possible to change the connection
> string that is used by the DatabaseFactory.CreateDatabase() method so that I
> can point it to my Access database?
>
> Thanks in advance.