从存储过程中获取输出 [英] get the output from stored Procedure

查看:60
本文介绍了从存储过程中获取输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



这是我的程序代码



Hi All ,

This is My Procedure code

CREATE PROCEDURE dbo.AddNewPerson
	(
	
	
	@FirstName nvarchar(50),
	
	@LastName nvarchar(50),
	@dateofbirth nvarchar(50),
		@Mrn int OUTPUT
		
	)
AS

BEGIN 



INSERT INTO Person(FirstName,LastName,dateofbirth)
		                         VALUES        (@FirstName,@LastName,@dateofbirth)
	 
		SELECT  @Mrn=SCOPE_IDENTITY();
		Return @Mrn
	END

	RETURN





我正在Class中使用SortedList将参数传递给StoredProcedure,如下所示Code behind





And I'm using SortedList in Class To Pass Parameters To StoredProcedure as following "Code behind"

SortedList SL = new SortedList();
       
        SL.Add("@FirstName", FirstName);
        SL.Add("@LastName", LastName);
        SL.Add("@dateofbirth", dateofbirth);
               

        ProcedureName = "AddNewPerson";
        if (db.RunProcedure(ProcedureName, SL) == 1)
            return true;
        else
            return false;
    }



插入成功但插入后如何在文本框中输入@Mrn值

我不知道如何将此输出添加到Sortedlist中的参数或我该怎么办?

??????????


The inserting is success but how can I get "@Mrn" Value in Text box after inserting
I dont know how to add this output to parameter in Sortedlist or what can I do ?
??????????

推荐答案

看看这里:

如何使用ASP.NET调用SQL Server存储过程Visual Basic .NET [ ^ ]

演练:使用以下方法调用存储过程SqlDataSource Web服务器控件 [ ^ ]

如何:执行存储返回无值的过程 [ ^ ]

如何:执行返回行的存储过程 [ ^ ]

如何:执行返回单个值的存储过程 [ ^ ]

使用SqlDataSource控件选择数据 [ ^ ]
Have a look here:
How to call SQL Server stored procedures in ASP.NET by using Visual Basic .NET [^]
Walkthrough: Calling a Stored Procedure Using the SqlDataSource Web Server Control[^]
How to: Execute a Stored Procedure that Returns No Value[^]
How to: Execute a Stored Procedure that Returns Rows[^]
How to: Execute a Stored Procedure that Returns a Single Value[^]
Selecting Data Using the SqlDataSource Control[^]


这篇关于从存储过程中获取输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆