如何将多个数据表从storeprocedure映射到没有数据集的列表 [英] how to map multiple datatable comming from storeprocedure to list without dataset

查看:54
本文介绍了如何将多个数据表从storeprocedure映射到没有数据集的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有storeprocedure,它返回两个表格,如

  create  程序 abc 
AS
开始
选择 empname,empid 来自 \\ temp

选择 vendname,venId 来自 vendore
end



在我的项目中我定义了两个属性,例如

  public  < span class =code-keyword> class  EMP 
{
public int empid { get ; set ;}
public string empname { get ; set ;}
}

public class 供应商
{
public int venId { get ; set ;}
public string vendname { get ; set ;}
}



如何从我的dataaccess图层调用storeprocedure并将输出值分配给
$这些(EMP,供应商)列表中的b $ b不使用数据集。

解决方案

在存储过程中使用Out参数并在c#中执行过程并分配Out参数您的房产(Emp和供应商)的价值。



查看以下链接了解更多详情。



ADO.NET - 如何使用输出参数调用存储过程? [ ^

I have storeprocedure which return two table like

create procedure abc
AS
Begin
    select empname,empid from emp

    select vendname,venId from vendore
end


in my project i define two properties like

public class EMP
{
   public int empid {get;set;}
   public string empname {get;set;}
}

public class Vendor
{
   public int venId {get;set;}
   public string vendname{get;set;}
}


how can i call storeprocedure from my dataaccess layer and assign output value to
in these (EMP,Vendor) list without using dataset.

解决方案

Use Out parameter in your Stored procedure and in c# execute the procedure and assign the Out parameter values to your Properties(Emp and Vendor).

check out below link for more details.

ADO.NET – How to call a stored procedure with output parameters?[^]


这篇关于如何将多个数据表从storeprocedure映射到没有数据集的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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