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

推荐订阅源

WordPress大学
WordPress大学
V
Visual Studio Blog
P
Privacy International News Feed
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
T
Threatpost
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
小众软件
小众软件
L
LINUX DO - 最新话题
C
Cisco Blogs
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
罗磊的独立博客
V
V2EX
博客园 - Franky
P
Proofpoint News Feed
SecWiki News
SecWiki News
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

博客园 - 骚包猪

未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序的解决办法 一份详尽的IPC$入侵资料 vlookup通俗解释 show interface counter 红旗linux下查看文件夹大小 Cisco 删除IOS后恢复、重灌ios x61在vista系统中玩wow魔兽世界 显示器驱动程序已停止响应 黑屏 终极解决方案 如何利用foobar2000将ape转aac格式.... ASP.NET执行SQL超时的解决方案 windows 更改IP地址 批处理文件 cmd命令 - 骚包猪 DropdownList绑定 - 骚包猪 - 博客园 关于datagrid鼠标悬停行数突出显示 - 骚包猪 - 博客园 c# ToString() 格式化字符串 - 骚包猪 ASCII 码表 一个检测文件 的small function c#时间格式化字符串详解 关于编码 建立一个基本SQl2000表 如何将txt文档插入sql2000数据库
.Net下调用SqlServer2k存储过程
骚包猪 · 2007-09-29 · via 博客园 - 骚包猪

首先,在SqlServer中创建存储过程,在调用时分为有参数和没有参数两种情况,先就简单的没有参数的情况简要的介绍:

  假设存储过程如下: CREATE PROC SelectAll

  AS

  SELECT * FROM StudentInf

  则此sp的调用如下:

  SqlCommand selectCMD = new SqlCommand(“SelectAll”, conn);

  //conn 为SqlConnection

  selectCMD.CommandType = CommandType.StoredProcedure;

  如果需要将结果集加到某个DataAdapter上,则可如下:

  SqlDataAdapter stuDA = new SqlDataAdapter();

  stuDa.SelectCommand = selectCMD;

  如果有参数:create proc andSelect

  @StudentId varchar(10),

  @StudentName varchar(10),

  As

  Select * from StudentInf where StudentId = @StudentId and StudentName = @StudentName

  则参数可以如下添加:

  selectCMD.Parameters.Add(“@StudentId”, SqlDbType.NVarChar, 10);

  selectCMD.Parameters.Add(“@StudentName”, SqlDbType.NvarChar, 10);

  如果只有一个参数,也可以这样赋值:

  SqlParameters onePara = selectCMD.Parameters.Add(“@StudentId”, SqlDbType.NVarChar, 10);

  onePara.Value = “ a string ”