add.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:
Email客户端
开发平台:
Visual C++
- /********************************************************************************
- ** 作者:ebDoing
- ** 创始时间: 2008-10-22
- ** 描述:
- ** 主要用于后台管理员添加商品,…
- ** 表:
- *********************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Data.SqlClient;
- using System.Configuration;
- namespace background
- {
- public class add
- {
- SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TZroomConnectionString"].ConnectionString);
- /// <summary>
- /// 添加商品
- /// </summary>
- /// <param name="name">商品名字</param>
- /// <param name="by">商品标语</param>
- /// <param name="sc">商品市场价格</param>
- /// <param name="hy">商品会员价格</param>
- /// <param name="ms">商品描述</param>
- /// <param name="zl">商品重量</param>
- /// <returns></returns>
- public bool addproduct(String name, String by, double sc, double hy, String ms,double zl)
- {
- String T_name = name;
- String T_by = by;
- double T_sc = sc;
- double T_hy = hy;
- String T_ms = ms;
- double T_zl = zl;
- String sql = "insert into tb_GoodsInfo(GoodsName,caption,MarketPrice,MemberPrice,GoodsDescription,GoodsWeight) values('" + T_name + "','" + T_by + "'," + T_sc + "," + T_hy + ",'" + T_ms + "',"+T_zl+")";
- SqlCommand cmd = new SqlCommand(sql, conn);
- int Resule = -1;
- try
- {
- conn.Open();
- Resule = cmd.ExecuteNonQuery();
- if (Resule != -1)
- {
- return true;
- }
- else {
- return false;
- }
- }
- catch (Exception ex)
- {
- throw (ex);
- }
- finally {
- conn.Close();
- }
- }
- }
- }