Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

Im creating dll for each screens in my project .I have a class which contains all database operations. when creating dll for this class im giving database info like this

string strconnection = "Data Source=CLIENT01;Initial Catalog=dbname;User ID=sa;Password=pawd.;";
iam referencing this dll in number of places
but when iam changing the connection info i have to again refer this dll in every where in my project as it is a common dll.
Is there any other methods giving database info in my project so that database class dll refer this location(like appconfig)
how to take value of database info while creating database class dll

Thanks in Advance
Posted

1 solution

Yes, you can.
Store connection string in config file (or even project Settings) instead of hard coding it.

Read this if you are interested in using standard .Net configuration.

Alternatively you can store data you're interested in .txt or .xml file with format and complexity of your own choosing.

I hope this helps.

P.S.
If you feel nostalgic for good old days, you can always store your data in .ini file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900