uppic.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.Configuration;
- using System.Data.SqlClient;
- namespace background
- {
- public class uppic
- {
- static String sql;
- SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TZroomConnectionString"].ConnectionString);
- /// <summary>
- ///
- /// </summary>
- /// <param name="id">商品id号码</param>
- /// <param name="filename">要上传文件的名字</param>
- /// <param name="flag">上传文件对应的标记</param>
- /// <returns></returns>
- public bool uppicFile(String id,String filename,String flag) {
- String T_id = id;
- String T_name = filename;
- String T_flag = flag;
- switch (flag) {
- case "linklogo":
- sql = "update tb_GoodsInfo set GoodsLnkLogo='" + T_name + "'where GoodsID=" + T_id + "";
- break;
- case "Brand":
- sql = "update tb_GoodsInfo set GoodsBrand='" + T_name + "'where GoodsID=" + T_id + "";
- break;
- case "Pic":
- sql = "update tb_GoodsInfo set GoodsPic='" + T_name + "'where GoodsID=" + T_id + "";
- break;
- }
- SqlCommand cmd = new SqlCommand(sql, conn);
- int Result = -1;
- try
- {
- conn.Open();
- Result = cmd.ExecuteNonQuery();
- if (Result != -1)
- {
- return true;
- }
- else {
- return false;
- }
- }
- catch (Exception ex)
- {
- throw (ex);
- }
- finally {
- conn.Close();
- }
- }
- }
- }