Convert.ToInt32(Session["waringup"])){Response.Write(" />
您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> .NET >> C#库存简单问题

C#库存简单问题

来源:网络整理     时间:2016/5/20 17:18:35     关键词:问题,库存

关于网友提出的“C#库存简单问题”问题疑问,本网通过在网上对“C#库存简单问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题:C#库存简单问题
描述:

c#

 protected void Button1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Session["snum"]) > Convert.ToInt32(Session["waringup"]))
        {
            Response.Write("");
            Response.End();
        }
        string CommodityId = this.CommodityId.Text.ToString();
        string CompanyId = this.CompanyId.Value.ToString();
        int Number = Math.Abs(Convert.ToInt32(this.Number.Text));
        int Pirce = Math.Abs(Convert.ToInt32(this.Pirce.Text));
        
        string SettlementType = this.SettlementType.Text.ToString();
        int Payment = Math.Abs(Convert.ToInt32(Request["Payment"]));
        int FactPayment = Math.Abs(Convert.ToInt32(this.FactPayment.Text));
        int NotPayment = Math.Abs(Convert.ToInt32(Request["NotPayment"]));
        string ManageMan = this.ManageMan.Text.ToString();
        string Username = Convert.ToString(Session["username"]);
        string AddTime = Convert.ToString(DateTime.Now);
        string Type = "进货信息";

        //计算输入的金额是否正确
        if (Number<0)
        {
            Response.Write("");
            Response.End();
        }
        if (Number * Pirce < Payment)
        {
            Response.Write("");
            Response.End();
        }

        SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        strcon.Open();
        OrderTime1.Text = DateTime.Now.ToString();
        SqlCommand scd = new SqlCommand("insert into tb_Stock (CommodityId,CompanyId,Number,Pirce,StockDate,SettlementType,Payment,FactPayment,NotPayment,ManageMan,Username,AddTime,Type)values('" + CommodityId + "','" + CompanyId + "','" + Number + "','" + Pirce + "','" + OrderTime1.Text + "','" + SettlementType + "','" + Payment + "','" + FactPayment + "','" + NotPayment + "','" + ManageMan + "','" + Username + "','" + AddTime + "','" + Type + "')", strcon);
        scd.ExecuteNonQuery();
        strcon.Close();
        Response.Write("alert('添加成功');location='Stock_add.aspx'");
    }
当中我加粗变红的是条件,我想问为什么我按button1的时候,就算我的条件成立了他也不会输出语句,而是直接添加成功?
以上介绍了“C#库存简单问题”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/1197666.html

相关图片

相关文章