You could store the value with replacement tokens such as:
<add key="ConnectionString" value="Select Diameter, Pitch, Quantity, Rotation, Bore, Blades, Material, Manufacturer, Model, Condition from PropInventory where Sold = False and Diameter >= ##DIAMETERPARAM## Order by Diameter" />
Then when you actually use this value you simply replace the token with the desired value in the code.
strQuery = ConfigurationManager.ApplicationSettings["ConnectionString"].Replace("##DIAMETERPARAM##", myDouble.ToString());
Alteratively, you could use the String.Format replacement tokens ( {0}, {1}, ...{n} ):
<add key="ConnectionString" value="Select Diameter, Pitch, Quantity, Rotation, Bore, Blades, Material, Manufacturer, Model, Condition from PropInventory where Sold = False and Diameter >= {0} Order by Diameter" />
then you use the standard String.Format method to do the replacement:
strQuery = string.Format(ConfigurationManager.ApplicationSett ings["ConnectionString"], myDouble);
This provide a slightly cleaner line of code, however there is a not an immediate relationship between the string going in (the appsetting value) and the replacement tokens. Using explicit token strings with the .Replace method will make it a bit more readable and maintainable.
-Peter
|