ASP:Gridview + DataSets Done Easy

Here is a neat little portion of code I stumbled across. It uses ObjectDataSource, and we sidestep writing our own sorting methods.

namespace Utils{
   public class DataSetUtils{
        public static DataSet GetMyDataSet()
        {
            using (SqlConnection con = new SqlConnection(Convert.ToString(HttpContext.Current.Application["con"])))
            {
                using (SqlCommand cmd = new SqlCommand("SELECT * FROM Students", con))
                {
                    cmd.CommandType = CommandType.Text;
                    DataSet ds = new DataSet();
                    SqlDataAdapter adp = new SqlDataAdapter();
                    adp.SelectCommand = cmd;
                    try  {
                        con.Open();
                        adp.Fill(ds);
                    } catch (Exception x)   {  /* do stuff */  }
                }
            }
        }
    }
}
<asp:GridView ID="uxGridView" runat="server" AllowSorting="true"  DataSourceID="ObjectDataSource1">
<Columns>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
  SelectMethod="GetMyDataSet" TypeName="Utils.DataSetUtils">
</asp:ObjectDataSource>