Select value from database based on dropdownlist value
<p>I have database table <code>leave_rec(name,date1,leave,ltype)</code>, a <code>Dropdown list</code> and a <code>gridview</code>.</p>

<p>I want to do such that,when I select month(e.g. february) in dropdown list the gridview should display all table values for february <code>only(e.g.rohan leuva,2/28/2013,full,casual)</code>,means record which has month=2 (february).</p>

<p>How to overcome this issue? I tried but I can only display all the values in <code>gridview</code> at this moment. Any help would be greatly appriciated.</p>

<pre><code>SqlConnection conn = new SqlConnection();
conn.ConnectionString=System.Configuration.ConfigurationManager.ConnectionStrings["leave"].ConnectionString;
conn.Open();
SqlCommand cmd = new SqlCommand("select date1,leave,ltype from leave_rec where name='" + DropDownList1.SelectedValue + "'", conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
</code></pre>

<p>The above code displays the <code>date1</code>,<code>leave</code>,<code>ltype</code> for <code>dropdownlist1.selectedvalue.</code> But now i want to have second dropdown in which months will be there. so when i select february in second one, grid should display value for dropdownlist1.selectedvalue for february only.</p>
