コード例 #1
0
    protected void BtnSvae_Click(object sender, EventArgs e)
    {
        string ProductId = Request.QueryString["ProductId"];
        string TypeName  = txtTypeName.Value.Trim();
        int    Order     = Convert.ToInt32(txtOrder.Value.Trim());
        string sql       = "update productType set productName=@productName,orderId=@orderId where productTypeid=@productTypeid";

        Tz888.DBUtility.CrmDBHelper crm = new Tz888.DBUtility.CrmDBHelper();
        SqlParameter[] Paras            = new SqlParameter[]
        {
            new SqlParameter("@productName", SqlDbType.VarChar, 50),
            new SqlParameter("@orderId", SqlDbType.Int),
            new SqlParameter("@productTypeid", SqlDbType.Int),
        };

        Paras[0].Value = TypeName;
        Paras[1].Value = Order;
        Paras[2].Value = ProductId;
        int result = crm.ExecuteSqls(sql, Paras);

        if (result > 0)
        {
            Tz888.Common.MessageBox.ShowAndHref("修改成功!", "ProductTypeManage.aspx");
        }
        else
        {
            Tz888.Common.MessageBox.Show(this.Page, "修改失败!");
        }
    }
コード例 #2
0
    protected void BtnSvae_Click(object sender, EventArgs e)
    {
        string sql      = "insert into productType(productName,orderId) values(@productName,@orderId)";
        string TypeName = txtTypeName.Value.Trim();
        int    Order    = Convert.ToInt32(txtOrder.Value.Trim());

        if (string.IsNullOrEmpty(Order.ToString()))
        {
            Order = 0;
        }

        Tz888.DBUtility.CrmDBHelper crm = new Tz888.DBUtility.CrmDBHelper();
        SqlParameter[] Paras            = new SqlParameter[] {
            new SqlParameter("@productName", SqlDbType.VarChar, 50),
            new SqlParameter("@orderId", SqlDbType.Int)
        };

        Paras[0].Value = TypeName;
        Paras[1].Value = Order;
        int result = crm.ExecuteSqls(sql, Paras);

        if (result > 0)
        {
            Tz888.Common.MessageBox.ShowAndHref("添加成功!", "ProductTypeManage.aspx");
        }
        else
        {
            Tz888.Common.MessageBox.Show(this.Page, "添加失败!");
        }
    }