.NET DLL's

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dmitry Lyalin

    #1

    .NET DLL's

    So tehre is no way to have a DLL read any kind of config file like
    app.config?

    My front end is an ASP.NET application and i was hoping to have all my
    database logic handled from within the component. Thats why i built a
    ConnectionStrin g class with static string functions to return my
    connection string.

    Anyone have any other ideas? I would hate to have to build a custom
    solution for something so simplistic.

    Maybe im just thinking about this in the wrong way from a design
    standpoint...

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Edd Connolly

    #2
    Re: .NET DLL's

    Dmitry,

    Add the following to the <configuratio n> section of your web.config file:

    <appSettings>
    <add key="Connection String" value="Data Source= ........." />
    </appSettings>

    Then in your dll, create a connection:

    SqlConnection connection = new
    SqlConnection(S ystem.Configura tion.Configurat ionSettings.App Settings["ConnectionStri ng"]);


    Or if you are using the designer for the Connection, check out the 'Dynamic
    Properties' section of the properties grid.


    --
    Edd Connolly

    MCP 70-315




    "Dmitry Lyalin" <webcontact@yah oo.com> wrote in message
    news:u4GhnAIhEH A.3980@TK2MSFTN GP12.phx.gbl...[color=blue]
    > So tehre is no way to have a DLL read any kind of config file like
    > app.config?
    >
    > My front end is an ASP.NET application and i was hoping to have all my
    > database logic handled from within the component. Thats why i built a
    > ConnectionStrin g class with static string functions to return my
    > connection string.
    >
    > Anyone have any other ideas? I would hate to have to build a custom
    > solution for something so simplistic.
    >
    > Maybe im just thinking about this in the wrong way from a design
    > standpoint...
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    Working...