1
I’m working on a project with 4 layers (Banco
, RegraNegocio
, Webforms
and Windows Forms
).
I made the following references:
Webforms > Regranegocio > Banco
winforms > Regranegocio > Banco
In my Class Library (bank) I have a file called: config.Settings
In this file I have only two properties of the type string
.
strconnection - where the connection is stored.
infoBanco - where is stored which database is, e.g.: (access, sqlserver, postgre)
I assign values to these properties when login (winforms) is performed. They work perfectly, but when I went to use Asp.net makes a mistake, saying I can’t use the arquivo.settings
.
I changed the scope of the User for application, but execution does not allow me to assign values to them at runtime. Properties have only {get;}
when the scope is that of application.
Does anyone know what I can do to store the connection string? Because I access a database where the customer’s records are stored, I take the connection string inside the table, and then access the respective client’s database.
On desktop it was simple: stored in config.Settings and already leaves using methods and class because every time I send a command it opens the new connection using the property strConnection that I initialized when the user logged in.
The Connection string is not stored in web.config by default?
– Jéf Bueno
but I access other banks, the string is not fixed, I pick it up in a database and wanted to keep it in my class library bank with the config.Settings managed on desktop but on web I don’t know how to do..
– Sarah