protected void Button1_Click(object sender, EventArgs e) { int result; cmd = new SqlCommand(" SELECT DATEDIFF(mm,"+DropDownList1.SelectedValue.ToString()+","+System.DateTime.Now.ToString()+") from productorder where email='"+Session["username"]+"'",con); result = cmd.ExecuteNonQuery(); }
select * from table_name where datediff(month, your_table_date_field, getDate()) > 12
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)