Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Thursday, March 09, 2006

....then don't hard-code your connection strings into the data source control. For example, rather than writing:

    <asp:SqlDataSource ID="SqlDataSource_Checkbox" runat="server" SelectCommand="select friendly_rolename from roles"
        ConnectionString="Data Source=blah;Persist Security Info=True;User ID=blah;Password=blahblah" ProviderName="Oracle.Data.DataClient">
    </asp:SqlDataSource>

...place everything in a web.config file and do this instead:

    <asp:SqlDataSource ID="SqlDataSource_Checkbox" runat="server" SelectCommand="select friendly_rolename from roles"
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>">
    </asp:SqlDataSource>

If I see another instance of someone thinking "no code" means "no brains" and copy a damn connection string to forty places in the declarative statements, I'm going to scream....


kick it on DotNetKicks.com
Thursday, March 09, 2006 11:55:38 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview

Computers Blogs - Blog Top Sites

Archive
<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009
Benjamin Rush
Sign In
Statistics
Total Posts: 444
This Year: 0
This Month: 0
This Week: 0
Comments: 128
Themes
Pick a theme:
All Content © 2009, Benjamin Rush
DasBlog theme 'Business' created by Christoph De Baene (delarou)