如何在C#LYNQ中使用OUTPUT参数调用STORED PROCEDURE? [英] How to call STORED PROCEDURE with OUTPUT parameter in C# LYNQ ?

查看:79
本文介绍了如何在C#LYNQ中使用OUTPUT参数调用STORED PROCEDURE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我必须在C#LYNQ中使用其Output参数调用存储过程。我正在使用MVC应用程序并使用LINQ to SQL。



有没有人应该有这样的方法然后请建议?



谢谢。

Hi,

I have to call stored procedure with its Output parameter in C# LYNQ. I am having MVC application and also using LINQ to SQL in that.

Is there anyone who should have such approach then please suggest ?

Thanks.

推荐答案

请看下面的网址:



getting-stored-procedure-output-parameter- with-linq-and-entity-framework [ ^ ]
Please have a look at the below url :

getting-stored-procedure-output-parameter-with-linq-and-entity-framework[^]


如果你使用Linq to Sql那么你只需要创建一个商店就很容易了定义了输出参数。然后简单地将商店p拖入.dbml文件并调用该商店p,您只需获取该值。



例如



If you are using Linq to Sql then it will be very easy you just need create a store p with a output parameter defined.After that simple drag your store p in .dbml file and call that store p you will simply get the value.

for eg

DataClassesDataContext db = new DataClassesDataContext();

     int a= db.usp_CheckBuyBookByISBN("9780199795352", null);



这里我正在调用名为usp_CheckBuyBookByISBN的商店p这个商店请求两个参数并返回一个整数值。


here i am calling a store p with name "usp_CheckBuyBookByISBN" this storep ask for two parameter and return you an interger value.


这篇关于如何在C#LYNQ中使用OUTPUT参数调用STORED PROCEDURE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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