I'm working on a project with 4 layers ( Banco
, RegraNegocio
, Webforms
and Windows Forms
).
I made the following references:
Webforms > Business Rule > Bank
winforms > Business Rule > Bank
In my Class Library ( bank ) I have a file called: config.settings
In this file I have only two properties of type string
.
strconnection - where the connection is stored.
infobank - where is stored which database is, eg: (access, sqlserver, postgre)
I assign values to these properties when the login is done (winforms). They work fine, but when I was using asp.net it gives an error, saying that I can not use arquivo.settings
.
I changed the scope of the User variables to application , but execution does not allow me to assign values to them at run time. The properties have only {get;}
when the scope is the application scope.
Does anyone know what I can do to store the connection string? Because I access a database where customer records are stored, I get the connection string inside the table, then access the database of the respective client.
On desktop it was simple: it was stored in config.settings and it already exits using methods and class because every time I send a command it opens the new connection using the strConnection property > that I initialized when the user logged in.