惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - 踏踏实实干

asp.net MVC4 框架揭秘 读书笔记系列3 asp.net MVC4 框架揭秘 读书笔记系列2 asp.net MVC4 框架揭秘 读书笔记系列1 什么?你还不会写JQuery 插件 jQuery命名空间,插件开发 微信开发资源 jstree 从简单说起Jquery 插件应用说明 sync framework参考收集系列 收集一些.net 组件开发资源 (转) C#事务 访问数据库(转) 多库查询 sp_addlinkedserver使用方法(添加链接服务器)(转)片段整理 asp.net 动态数据网站简单应用,快速建立站点实现对库方便的增删改 利用asp.net路由实现url解析 智能客户端(Smart Client )中文文档及案例(转贴) 利用反射对对象属性赋值取值操作 男人30而立,30岁的男人喊起来!你们立了吗? jquery 实现从左边listbox选择至右边listbox asp.net 造成seesion 丢失的问题之一 转摘 JQUERY操作JSON例子
c# 调用SQL Server存储过程返回值(转)
踏踏实实干 · 2012-02-11 · via 博客园 - 踏踏实实干

--用ParameterDirection.ReturnValue; 返回值
CREATE PROCEDURE dbo.a
AS
declare @i int
select   @i=count(*) from tbD_M_Modle
return @i
GO

--用ParameterDirection.Output; 参数返回值
CREATE PROCEDURE dbo.a
@i int output
AS

select   @i=count(*) from tbD_M_Modle
return @i
GO


//
SqlCommand cmd = new SqlCommand("a", myConn);
cmd.CommandType = CommandType.StoredProcedure;

//输入值
//SqlParameter a1 = new SqlParameter("@a", SqlDbType.VarChar, 100);
//a1.Value="aaa";
//cmd.Parameters.Add(a1);

//返回值
SqlParameter i = new SqlParameter("@ii", SqlDbType.Int,4);
i.Direction = ParameterDirection.Output;
//i.Direction = ParameterDirection.ReturnValue;

cmd.Parameters.Add(i);

cmd.ExecuteNonQuery();

string strReturn = i.Value.ToString(); //返回值--方法1
string a = cmd.Parameters["@ii"].Value.ToString(); ////返回值--方法2

cmd.Connection.Close();