⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stockpile_search.aspx.cs

📁 基于JSP+SQL Sever2000+Tomcat的网络服务器体系结构开发技术和对数据库技术的进一步了解以及对政府网站的调查研究
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Stockpile_Stockpile_search : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["username"]) == "")
        {
            Response.Write("<script language=javascript>alert('请登录');location='../login.aspx'</script>");
            return;
        }
        if (!IsPostBack)
        {
            Session["sqls"] = "";
            this.bind();      
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        this.bind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        stockClass sc=new stockClass();
        if(e.Row.RowType==DataControlRowType.DataRow)
        {
            e.Row.Cells[3].Text = Convert.ToString(sc.stock(Convert.ToInt32(e.Row.Cells[3].Text)));
            e.Row.Cells[4].Text = Convert.ToString(sc.sell(Convert.ToInt32(e.Row.Cells[4].Text)));
            e.Row.Cells[5].Text = Convert.ToString(sc.stock(Convert.ToInt32(e.Row.Cells[5].Text)) - sc.sell(Convert.ToInt32(e.Row.Cells[5].Text)));
        }
    }
    public void bind()
    {
        SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        strcon.Open();
        string sqlstr="select * from Stockpile where id is not null "+Session["sqls"]+" order by id desc";
        SqlDataAdapter sda = new SqlDataAdapter(sqlstr,strcon);
        DataSet ds = new DataSet();
        sda.Fill(ds, "Stockpile");
        GridView1.DataSource = ds.Tables["Stockpile"];
        GridView1.DataKeyNames = new string[] {"id"};
        GridView1.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sqls = "";
        if (this.CheckBox1.Checked)
        {
            sqls = sqls+"and CommodityName like '%"+Request["TN"]+"%' ";
        }
        if (this.CheckBox2.Checked)
        {
            sqls = sqls + "and CompanyName like '%" + Request["PN"] + "%'";
        }
        Session["sqls"] = sqls;
        this.bind();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Session["sqls"] = "";
        this.bind();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -