Click here to Skip to main content
15,501,036 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using enterprise library for data connection.how can i add connection string in cs file... no need of adding in configuration..

my reqirment is adding connection in csharp program file.
Posted
Updated 4-Nov-11 22:35pm
v2

It is considered a bad idea to "hardwire" any connection string into your application (which is what including it in the .CS file would do). The reason being that your application would need to be modified should an external change in circumstances or network topology etc. occur - which is quite likely in most environments. That means that the source must be available, a programmer who knows the source must be available, and the compiler must be available. This is not a good thing as it can mean big, unnecessary delays and disruption.

Is there a good reason why you do not want this is in a config file, where it can be easily modified if required?
 
Share this answer
 
Comments
Uday P.Singh 5-Nov-11 4:08am    
agree 5+
member60 5-Nov-11 5:20am    
cool

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