标题:求各位大侠帮详细解释一下 答辩用 谢谢
只看楼主
zhanbin00520
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-6-3
 问题点数:0 回复次数:0 
求各位大侠帮详细解释一下 答辩用 谢谢
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sql;
            sql = "select bh from allpro order by id desc";
            getdata(sql);
        }
    }
    private void getdata(string sql)
    {
        DataSet result = new DataSet();
        result = new Class1().hsggetdata(sql);
        if (result != null)
        {
            if (result.Tables[0].Rows.Count > 0)
            {
                int k = 0;
                for (k = 0; k < result.Tables[0].Rows.Count; k++)
                {
                    bh.Items.Add(result.Tables[0].Rows[k]["bh"].ToString().Trim());
                }
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql;
        sql = "select * from kucun where bh='"+bh.SelectedItem.ToString().Trim()+"'";
        DataSet result = new DataSet();
        result = new Class1().hsggetdata(sql);
        if (result != null)
        {
            if (result.Tables[0].Rows.Count > 0)
            {
                sql = "update kucun set shuliang=shuliang+"+shuliang.Text.ToString().Trim()+" where bh='"+bh.SelectedItem.ToString().Trim()+"'";

            }
            else
            {
                sql = "insert into kucun(bh,ggxh,dw,promc,price,shuliang,gys,rkprice) values('" + bh.SelectedItem.ToString().Trim() + "','" + ggxh.Text.ToString().Trim() + "','" + dw.Text.ToString().Trim() + "','" + promc.Text.ToString().Trim() + "'," + price.Text.ToString().Trim() + "," + shuliang.Text.ToString().Trim() + ",'" + gys.Text.ToString().Trim() + "'," + rkprice.Text.ToString().Trim() + ")";
               
            }
        }
        int result2;
        result2 = new Class1().hsgexucute(sql);
        sql =  "insert into ruku(bh,ggxh,dw,promc,price,shuliang,gys,rkprice) values('" + bh.SelectedItem.ToString().Trim() + "','" + ggxh.Text.ToString().Trim() + "','" + dw.Text.ToString().Trim() + "','" + promc.Text.ToString().Trim() + "'," + price.Text.ToString().Trim() + "," + shuliang.Text.ToString().Trim() + ",'" + gys.Text.ToString().Trim() + "'," + rkprice.Text.ToString().Trim() + ")";
        result2 = new Class1().hsgexucute(sql);
        if (result2 == 1)
        {
            Response.Write("<script>javascript:alert('操作成功');</script>");
        }
        else
        {
            Response.Write("<script>javascript:alert('系统错误,您输入了非法字符!');</script>");
        }
   
搜索更多相关主题的帖子: 答辩 解释 
2010-06-03 08:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-309110-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.121391 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved