⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 goods.cs

📁 天织在线购物网站完整源码及文档 本网站是一套基于Web2.0思想设计、采用asp.net2.0开发的社区门户产品。它同时也是一套Web2.0全面解决方案
💻 CS
字号:
/********************************************************************************
** 作者:高亮
** 创始时间: 2007-12-22
** 描述:
**    主要用于后台管理员修改商品信息,…
** 表:
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
namespace SearchGoods
{
    public class goods
    {
        int gid;
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CartConnectionString"].ConnectionString);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="GoodsName"></param>
        /// <returns></returns>
        public int GetGoodsID(String GoodsName) {
            String T_name = GoodsName;
            String sql = "select * from tb_GoodsInfo where GoodsName='" + T_name + "'";
            SqlCommand cmd = new SqlCommand(sql, conn);
            try
            {
                conn.Open();
                SqlDataReader MyReader = cmd.ExecuteReader();
                if (MyReader.Read()) {
                    gid = MyReader.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally {
                conn.Close();
            }
            return gid;
        }
        }
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -