Hi experts.
I have an ASP.Net page with a DropDownList called cboYear. This gets filled
with a c# method as follows.
private void FillYearList() {
SqlConnection cn = new SqlConnection();
cn = DatEngine.TimeOffConn;
SqlCommand sc = new SqlCommand("SELECT intYear, Description FROM
dbo.vwYearSelector ",cn);
cn.Open();
SqlDataReader dr =sc.ExecuteReader();
//Set the values to be used from the database for the combo
cboYear.DataSource = dr; //attach Datareader
cboYear.DataValueField = "intYear"; //specify column that contains the
value to use
cboYear.DataTextField= "Description"; //specify column that contains the
value to see
cboYear.DataBind();
cn.Close(); //Must close this!!!!
dr.Close();
}
The data in vwYearSelector is
intYear Description
2004 2004
2005 2005/2006
2006 2006/2007
2007 2007/2008
All this worked fine in 2004, however now in 2005, the cboYear still
initially shows the 2004. How can I set the cboYear to now display 2005/2006
when the page first loads. 2004 could then be selected if required later.
Thanks