All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET技巧:错误处理封装_[Asp.Net教程]
ASP.NET中常用的优化性能方法_.net资料_编程技术
简单介绍.Net3.0,中跨线程访问控件_.net资料_编程技术
Silverlight,2(beta1)数据操作(7)—调用FlickR,REST,APIs来询图片_[Asp.Net教程]
SQL数据操作基础(中级)6_mssql学习_编程技术
delphi类的多态性
PHP+MYSQL建设网站程序需要注意两点_php资料_编程技术
C#中创建用户控件应用实例
实例详解网页表单格式的应用技巧_[Html教程]
delphi多行编辑框组件(TMemo)使用实例
Reading number is top 10 pictures
The little woman's bright wire1
So beauty, will let you spray blood2
湖边的风景
Embarrassing things comic collection2
30 beautiful school beauty4
30 beautiful school beauty3
XuRe xuan cool and refreshing photoes2
锄禾日了几个人?
Absolutely shocked. National geographic 50 animal photographys3
夕阳下的北京街道
Download software ranking
Rio big adventure
终极变速大师Speeder3.26
White deer villiage
Take off clothes to survival
功夫熊猫2(上集)
虚拟机5.5.3版
Prostitutes diary
Tram sex maniac 2 (H) rar bag1
Boxer's Top ten classic battle3
Sora aoi - one of more PK
归海一刀 published in(发表于) 2014/1/30 1:17:59 Edit(编辑)
Asp.net三层结构中的变量引用与传递_[Asp.Net教程]

Asp.net三层结构中的变量引用与传递_[Asp.Net教程]

Asp.net三层结构中的变量引用与传递_[Asp.Net教程]
Asp.net层架构主要是为了解决数据层,逻辑层,表示层等之间的关系。
我们的做法是这样的:首先建立一个DataCore的基类。基类里面封装了一些低层的数据库的基本操作,比如说数据库联接,调用存储过程等等。在这里面有一个地方值得注意,通过对一个函数的重载可以实现调用不同功能的存储过程。
以下代码示例:


protected int RunProcedure(string storedProcName, IDataParameter[] parameters, out int

rowsAffected )
{

int result;

Connection.Open();

SqlCommand command = BuildIntCommand( storedProcName, parameters );

rowsAffected = command.ExecuteNonQuery();

result = (int)command.Parameters["ReturnValue"].Value;

Connection.Close();

return result;

}

protected SqlDataReader RunProcedure(string storedProcName, IDataParameter[] parameters )

{

SqlDataReader returnReader;

Connection.Open();

SqlCommand command = BuildQueryCommand( storedProcName, parameters );

command.CommandType = CommandType.StoredProcedure;

returnReader = command.ExecuteReader();

//Connection.Close();

return returnReader;

}

protected DataSet RunProcedure(string storedProcName, IDataParameter[] parameters,

string tableName )

{

DataSet dataSet = new DataSet();

Connection.Open();

SqlDataAdapter sqlDA = new SqlDataAdapter();

sqlDA.SelectCommand = BuildQueryCommand( storedProcName, parameters );

sqlDA.Fill( dataSet, tableName );

Connection.Close();

return dataSet;

}

protected void RunProcedure(string storedProcName, IDataParameter[] parameters,

DataSet dataSet, string tableName )

{

Connection.Open();

SqlDataAdapter sqlDA = new SqlDataAdapter();

sqlDA.SelectCommand = BuildIntCommand( storedProcName, parameters );

sqlDA.Fill( dataSet, tableName );

Connection.Close();

}



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.