/// <summary> /// 得到一个对象实体 /// </summary> public webs_YueyxShop.Model.ProductSEOBase DataRowToModel(DataRow row) { webs_YueyxShop.Model.ProductSEOBase model=new webs_YueyxShop.Model.ProductSEOBase(); if (row != null) { if(row["pseo_ID"]!=null && row["pseo_ID"].ToString()!="") { model.pseo_ID=int.Parse(row["pseo_ID"].ToString()); } if(row["p_ID"]!=null && row["p_ID"].ToString()!="") { model.p_ID=int.Parse(row["p_ID"].ToString()); } if(row["pseo_Title"]!=null) { model.pseo_Title=row["pseo_Title"].ToString(); } if(row["pseo_Content"]!=null) { model.pseo_Content=row["pseo_Content"].ToString(); } if(row["pseo_Keys"]!=null) { model.pseo_Keys=row["pseo_Keys"].ToString(); } if(row["pseo_PicAlt"]!=null) { model.pseo_PicAlt=row["pseo_PicAlt"].ToString(); } if(row["pseo_PicTitle"]!=null) { model.pseo_PicTitle=row["pseo_PicTitle"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public webs_YueyxShop.Model.ProductSEOBase GetModel(int pseo_ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 pseo_ID,p_ID,pseo_Title,pseo_Content,pseo_Keys,pseo_PicAlt,pseo_PicTitle from ProductSEOBase "); strSql.Append(" where pseo_ID=@pseo_ID "); SqlParameter[] parameters = { new SqlParameter("@pseo_ID", SqlDbType.Int,4) }; parameters[0].Value = pseo_ID; webs_YueyxShop.Model.ProductSEOBase model=new webs_YueyxShop.Model.ProductSEOBase(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }