SellectCommad.connection Property not initialized
<p>When i debug my application, it gives an error that SelectCommand.Connection Property is not been initialized. i dont know what am i doing here wrong :s. I actually want to add a filter over my search on the textchanged event of a textbox.</p>

<pre><code>public class ConnectionClass
{
    static SqlConnection cn;

    public static SqlConnection Connection()
    {
        string myConnection = ConfigurationManager.ConnectionStrings["_uniManagementConnectionString1"].ConnectionString;
        if (cn != null)
        {
            cn = new SqlConnection(myConnection);
            cn.Open();
        }
        return cn;
    }

}    

public class ClassDataManagement 
{ 
    SqlConnection cn = ConnectionClass.Connection();

    public DataTable GetData(string SQL)
    {
         SqlCommand cmd = new SqlCommand(SQL, cn);
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         DataTable dt = new DataTable();
         da.Fill(dt);
         return dt;
    } 
}

protected void TextBoxFilterText_TextChanged(object sender, EventArgs e)
{
   ClassDataManagement dm = new ClassDataManagement();
   string query = "Select CourseCode from _Courses where coursecode like'%" + TextBoxFilterText.Text.TrimEnd() + "%'";
   dm.GetData(query);
   GridViewCourses.DataBind();
}
</code></pre>
