double Month = Convert.ToDouble(DropDownList1.SelectedItem.Value); double Year = Convert.ToDouble(DropDownList2.SelectedItem.Value); string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("SELECT a.FirstName +' '+ a.MiddleName +' '+a.LastName as ApplicantName,a.ApplicationNo,b.[ApplicationDate] FROM [Applicant]as a,Application as b where a.ApplicationNo= b.ApplicationNo and MONTH(b.ApplicationDate) = @Month and YEAR(b.ApplicationDate) = @Year ")) //using (SqlCommand cmd = new SqlCommand("SELECT a.FirstName +' '+ a.MiddleName +' '+a.LastName as ApplicantName,a.ApplicationNo,b.[ApplicationDate] FROM [Applicant]as a,Application as b where a.ApplicationNo= b.ApplicationNo and YEAR(b.ApplicationDate) = @Year ")) { SqlParameter param = new SqlParameter(); param.ParameterName = "@Month"; param.Value = Month; cmd.Parameters.Add(param); //SqlParameter param = new SqlParameter(); param.ParameterName = "@Year"; param.Value = Year; cmd.Parameters.Add(param);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)