xiaoshou/xiaoshouadd.aspx.cs

(完整代码) 1KB

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using dao;
public partial class xiaoshou_xiaoshouadd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string spid = this.spid.SelectedValue.ToString();
        string sl = this.sl.Text;
        string crz = this.czr.Text;
        string sj = System.DateTime.Now.ToString();
        string jg = this.jg.Text;
        string cx = this.cx.SelectedValue.ToString();
        if (spid.Length == 0)
        {
            MessageBox.Show(this.Page, "商品不能为空");
            return;
        }
        if (sl.Length == 0)
        {
            MessageBox.Show(this.Page, "数量不能为空");
            return;
        }
        if (crz.Length == 0)
        {
            MessageBox.Show(this.Page, "操作人不能为空");
            return;
        }
        int row = 0;
        string sql = "insert into xiaoshou(spid,sl,czr,xssj,cx,jg) values('" + spid + "','" + sl + "','" + crz + "','" + sj + "','"+cx+"','"+jg+"')";
        try
        {
            row = DBHelper.ExecuteCommand(sql);
            sql = "update shangpin set sl=sl-" + sl + " where spid='" + spid + "'";
            row = DBHelper.ExecuteCommand(sql);
        }
        catch (Exception ex)
        {
            MessageBox.ShowAndRedirect(this.Page, ex.Message, "xiaoshouadd.aspx");

        }
        MessageBox.ShowAndRedirect(this.Page, "销售登记成功", "xiaoshouadd.aspx");
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。