hi for all i have two stored procedure to retrive data from data base one before
one week and the other before two week
ALTER PROCEDURE beforeweek
AS
select *
from files
where [date] < dateadd(wk,-1,getdate())
and the other
ALTER PROCEDURE beforeweek
AS
select *
from files
where [date] < dateadd(wk,-2,getdate())
and in my search page i add dropdownlist have two values
for choice the values is week and tweek
i add inside button search this code
Session["date"] = DropDownList2.SelectedValue;
Response.Redirect("resultpage.aspx");
and inside the second page i add gridview to display the result
and i add inside page load event this code
if (Session["date"] != null)
{ if(Session ["date"]=="week"){
SqlCommand cmd = new SqlCommand("beforeweek", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter dept = new SqlDataAdapter(cmd);
DataSet dsw = new DataSet("files");
dept.Fill(dsw);
GridView1.DataSource = dsw;
GridView1.DataBind();}
else if(Session ["date"]=="tweek"){
SqlCommand cmd = new SqlCommand("beforetwoweek", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter dept = new SqlDataAdapter(cmd);
DataSet dst = new DataSet("files");
dept.Fill(dst);
GridView1.DataSource = dst;
GridView1.DataBind();
}
}
but without result any one can modify and correct to me
the code
and thanks