SQLServerDAL/product.cs

(开头部分) 11KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using CAI.SHOP.IDAL;
using Maticsoft.DBUtility;//请先添加引用
namespace CAI.SHOP.SQLServerDAL
{
	/// <summary>
	/// 数据访问类product。
	/// </summary>
	public class product:Iproduct
	{
		public product()
		{}
		#region  成员方法

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
		return DbHelperSQL.GetMaxID("pid", "product"); 
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int pid)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from product");
			strSql.Append(" where pid=@pid ");
			SqlParameter[] parameters = {
					new SqlParameter("@pid", SqlDbType.Int,4)};
			parameters[0].Value = pid;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(CAI.SHOP.Model.product model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into product(");
			strSql.Append("classid,classxid,productname,productintroduce,productchu,productimage,masterprice,hotprice,newproduct,guige,productguanjian,adddate,pkc,sl,hittimes,jifen,zenpin)");
			strSql.Append(" values (");
			strSql.Append("@classid,@classxid,@productname,@productintroduce,@productchu,@productimage,@masterprice,@hotprice,@newproduct,@guige,@productguanjian,@adddate,@pkc,@sl,@hittimes,@jifen,@zenpin)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@classid", SqlDbType.Int,4),
					new SqlParameter("@classxid", SqlDbType.Int,4),
					new SqlParameter("@productname", SqlDbType.NVarChar,50),
					new SqlParameter("@productintroduce", SqlDbType.Text),
					new SqlParameter("@productchu", SqlDbType.NVarChar,200),
					new SqlParameter("@productimage", SqlDbType.NVarChar,50),
					new SqlParameter("@masterprice", SqlDbType.Decimal,9),
后面还有 270 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。