Do you hard code your ConnectionString?
  v3.0 Posted at 20/10/2010 7:56 PM by System Account
We don't like hard coded string inside our programme. We are using model-driven development, in which we create or reuse code, and perform changes in configuration file rather the in-code changing. More information on implementing our configuration.
connection.ConnectionString = "
Data Source=server_name_or_address; Initial Catalog=database_name;
User ID=username; Password=password; ";

Bad code - use the lengthy connection string.
connection.ConnectionString = ConfigurationManager.Items["ConnectionString"];

Figure: Good Code - Use ConfigurationManager to handle the connection string.
We have a program called SSW Code Auditor to check for this rule.

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: