uppic.cs
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:

Email客户端

开发平台:

Visual C++

  1. /********************************************************************************
  2. ** 作者:ebDoing
  3. ** 创始时间: 2008-10-22
  4. ** 描述:
  5. **    主要用于后台管理员修改图片信息,…
  6. ** 表:
  7. *********************************************************************************/
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Text;
  11. using System.Configuration;
  12. using System.Data.SqlClient;
  13. namespace background
  14. {
  15.     public class uppic
  16.     {
  17.         static String sql;
  18.         SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TZroomConnectionString"].ConnectionString);
  19.         /// <summary>
  20.         /// 
  21.         /// </summary>
  22.         /// <param name="id">商品id号码</param>
  23.         /// <param name="filename">要上传文件的名字</param>
  24.         /// <param name="flag">上传文件对应的标记</param>
  25.         /// <returns></returns>
  26.         public bool uppicFile(String id,String filename,String flag) {
  27.             String T_id = id;
  28.             String T_name = filename;
  29.             String T_flag = flag;
  30.             switch (flag) { 
  31.                 case "linklogo":
  32.                     sql = "update tb_GoodsInfo set GoodsLnkLogo='" + T_name + "'where GoodsID=" + T_id + "";
  33.                     break;
  34.                 case "Brand":
  35.                     sql = "update tb_GoodsInfo set GoodsBrand='" + T_name + "'where GoodsID=" + T_id + "";
  36.                     break;
  37.                 case "Pic":
  38.                     sql = "update tb_GoodsInfo set GoodsPic='" + T_name + "'where GoodsID=" + T_id + "";
  39.                     break;
  40.             }
  41.             SqlCommand cmd = new SqlCommand(sql, conn);
  42.             int Result = -1;
  43.             try
  44.             {
  45.                 conn.Open();
  46.                 Result = cmd.ExecuteNonQuery();
  47.                 if (Result != -1)
  48.                 {
  49.                     return true;
  50.                 }
  51.                 else {
  52.                     return false;
  53.                 }
  54.             }
  55.             catch (Exception ex)
  56.             {
  57.                 throw (ex);
  58.             }
  59.             finally {
  60.                 conn.Close();
  61.             }
  62.         }
  63.     }
  64. }