title: Writing queries in code behind vs. SqlDataSource
body: <p>I always have this notion that writing SQL queries in the code behind is not good compared to writing it using a SqlDataSource</p>
  
  <pre><code>SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Categories", myConnection);
  
  DataSet ds = new DataSet();
  
  ad.Fill(ds, "Categories");
  
  myGridView.DataSource = ds;
  
  myGridView.DataBind();
  </code></pre>
  
  <p>vs.</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="&lt;%$ ConnectionStrings:myConnection %&gt;"
    SelectCommand="SELECT * FROM Categories" /&gt;
  </code></pre>
  
  <p>I feel using SqlDataSource is secure, easy to maintain.
  Is my concern true? Please justify.</p>