Hello ?,
I don't understand why you don't want to put the connection string in the
web.config file. You can use can add a key to the appSettings node and
reference it in code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="myconnstring" value="connectionstringgoeshere" />
In code:
db.connstring = ConfigurationSettings.AppSettings("myconnstring")
Ken
"Random" <ci*******@hotmail.com> wrote in message
news:OG**************@TK2MSFTNGP09.phx.gbl...
I'm writing a class library for my web app data access, but don't want to
hard code the database connection string in the class. Nor do I want to
pass the connection string in from the web app every time I access it. I
want to define the connection string in the web app ConfigurationSettings
and let the class library reference it itself whenever it needs a
connection.
How can I do this?