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

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
O
OpenAI News
W
WeLiveSecurity
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Troy Hunt's Blog
L
LINUX DO - 最新话题
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
Project Zero
Project Zero
Attack and Defense Labs
Attack and Defense Labs
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Tor Project blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
Spread Privacy
Spread Privacy
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric
I
Intezer
The Hacker News
The Hacker News
L
LINUX DO - 热门话题
AI
AI
B
Blog
S
Securelist
P
Proofpoint News Feed
量子位
Jina AI
Jina AI
V2EX - 技术
V2EX - 技术
T
The Exploit Database - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 什么都不知道

DataSet的Xml序列化问题 VB.NET的一个小问题 Access is denied的问题 - 什么都不知道 SQL Server的效率? datagrid刷新问题 使用Visio DrawingControl的应用开发(补) 突起效果的Label WinForm下TextBox的数据绑定和更新 使用Radio按钮选择DataGrid行 如何在运行时加载不处于应用程序目录下的assembly 使用VSA给程序加上脚本支持 删除所有Windows组件 在ASP.NET中嵌入wml标记 c#中动态装载dll 处理大型xml文件 RedirectToMobilePage的问题 使用Visio 2003 Drawing Control开发应用(3)(4) 使用Visio 2003 Drawing Control开发应用(2) 使用Visio 2003 Drawing Control开发应用(1)
存储过程output参数问题
什么都不知道 · 2005-01-14 · via 博客园 - 什么都不知道

下面的存储过程,ID1是同时作为输入输出参数的。

CREATE Procedure usp_test
 @ID1 int output,
 @ID int
AS

IF @ID1 = 0
BEGIN
 SELECT * FROM Customers
 SET @ID1 = 1
 end
ELSE
begin
 SELECT Employees.* FROM Employees
 SET @ID1 = 2
end
GO


通过查询分析器直接运行还是通过VS.NET都能正常运行,可是当用ado.net写一个程序调用时,就不一样了。设置ID1这个参数等于0根本没有用,从Profiler来看,ID1一上来就是1,IF那部分不会执行下去。
不过,如果将两个参数调整一下位置就可以了
CREATE Procedure usp_test
 @ID int,
 @ID1 int output
AS .....
有些奇怪,因无从下手找KB,不知道这个是不是ADO.NET的问题,还是其他问题

(1-15更新)

问题好像不是那么简单,今天无论调整成怎样都不行。后来又好了,但是不关次序的问题,而是与设置ParameterDirection.InputOutput还是ParameterDirection.Output有关。而且发现当是ParameterDirectioin.Output的时候,参数设置什么都没有用,都是NULL,存储过程改称

IF @ID1 = 0  OR @ID1 is NULL

就可以了

不过,即使设置了ID1=1也执行不了ELSE的内容,奇怪的问题。