大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> NET专区 -> Asp.Net(C#)+Sql Server三层架构下数据存取方案(二)

Asp.Net(C#)+Sql Server三层架构下数据存取方案(二)

时间: 2021-07-31 作者:daque

保存进程:/**********************************功效:按照确定前提读取功效记载作家:rexsp创造日子:2004-01-13窜改者:窜改日子:**********************************/alter procedure getscoresetting( @scoresettingid int=-1, ---树立id @functionid int=-1, ---功效id @operationid int=-1, ---操纵id @roletypeid int=-1, ---脚色典型 @bbstypeid int=-1, ---版块典型 @score int=-1, ---积分树立 @bb int=-1, ---币币树立 @buytype int=-1, ---购置典型 0:不是购置典型 1:一次性购置 2:重复购置 @functionstate int=-1 ---功效状况)asset nocount on declare @strsql nvarchar(1000)set @strsql = 'select * from [scoresetting] where @ckscoresettingid = @ckscoresettingid'--- add keywords begin ---if @scoresettingid<> -1 begin set @strsql = @strsql + ' and scoresettingid= @ckscoresettingid' endif @functionid<> -1 begin set @strsql = @strsql + ' and functionid= @ckfunctionid' endif @operationid<>-1 begin set @strsql = @strsql + ' and operationid = @ckoperationid' endif @roletypeid<>-1 begin set @strsql = @strsql + ' and roletypeid = @ckroletypeid' endif @bbstypeid<>-1 begin set @strsql = @strsql + ' and bbstypeid = @ckbbstypeid' endif @score<>-1 begin set @strsql = @strsql + ' and score = @ckscore' endif @bb<>-1 begin set @strsql = @strsql + ' and bb= @ckbb' endif @buytype<>-1 begin set @strsql = @strsql + ' and buytype= @ckbuytype' endif @functionstate<>-1 begin set @strsql = @strsql + ' and functionstate= @ckfunctionstate' end--- add where key word ------ run sql begin ---execute sp_executesql @strsql, n' @ckscoresettingid int, @ckfunctionid int, @ckoperationid int, @ckroletypeid int, @ckbbstypeid int, @ckscore int, @ckbb int, @ckbuytype int, @ckfunctionstate int', @ckscoresettingid=@scoresettingid, @ckfunctionid=@functionid, @ckoperationid = @operationid, @ckroletypeid = @roletypeid, @ckbbstypeid = @bbstypeid, @ckscore = @score, @ckbb = @bb, @ckbuytype = @buytype, @ckfunctionstate = @functionstate--- run sql end ---一点证明:此保存进程会按照数据层的类有没有传播相映的参数值进入而动静创造查问语句,而后用体例自带的保存进程实行sql语句,用体例保存进程实行sql语句的长处是不妨机动转义字符。而动静创造查问语句的长处,就特殊大了,这会省下咱们写很多种前提确定,更加是对那些字段比拟多的表来讲,一个陈设拉拢下来的情景太多了,而运用保存进程动静创造sql语句所作的确定数和字段数基础上是普遍的,这边会给入参赋初始值,即使不即是初始值就证明数据层类有传播参数进入,如许就加上相映前提字符的

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.