hello
display data last 3 month
should add AND or & ?
both not working
DATEADD(MONTH, -3, GETDATE()) ORDER BY [id] DESC"
code from here this link
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindGridView();
}
}
private void BindGridView()
{
string str = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(str))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT * FROM Table_vacation WHERE namevacation = @Con1 OR namevacation = @Con2 ORDER BY [ID] DESC";
cmd.Parameters.AddWithValue("@Con1", "اجازة دورية");
cmd.Parameters.AddWithValue("@Con2", "اجازة دورية للاشرافيين");
cmd.Connection = con;
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
using (DataTable dt = new DataTable())
{
da.Fill(dt);
this.gvFiles.DataSource = dt;
this.gvFiles.DataBind();
}
}
}
}
}