The connection string in WebApp and class library

A

ad

I have a web application and a class library in a solution.

The class library is make of typed datasets, and include many Table in it.
The connection strings of the TableAdapters is come from the app.config of
that class library.

The Web application refer the class library, and the connection strings of
WebApp is come from the web.config of it.

It is ok in developing step, I can make both connection string identical in
both config files, but after I publish the web application or package the
web application for deployment, the app.config is vanish, so that if can
just change the connection if web.config, but can't change the connection is
app.config.

How can I do?
 
G

Guest

ad,
your post seems to assume that the value for the class library is being read
from "it's own" app.config. Class Libraries (DLL) cannot use configuration
files natively. Store all your items in the web.config and they will be
available to the class library if it is referenced in the web application
project.

Peter
 
G

ghuckson

Hi Peter, thanks for your post - I am having similar problems. Can I
ask you for a little more depth please. My web.config settings don't
seem to propagate down to the table adapters which sit in my class
library. The table adapters just use the same connection string as
specified in the class library app.config file.
can you please give me an example of how I am supposed to 'fully
qualify' the name of the connection string in the web.config file.

If you, or anybody else could please tell me how I can do? - then I
would be very grateful.
Thanks very much in advance.
Glyn.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top