如何从c#传递datatable到oracle存储过程 [英] how to pass datatable to oracle store procedure from c#

查看:577
本文介绍了如何从c#传递datatable到oracle存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我们在SQL中可以做的那样如何将数据表传递给oracle store proc



 OracleParameter [] parameter = {
new OracleParameter( IN_UserRoleMapping, dt)
};





 创建 替换
TYPE OBJ_USERROLEMAPPINGTYPE AS OBJECT

RoleId NUMBER



创建 替换
< span class =code-keyword> TYPE USERROLEMAPPINGTYPE
AS < span class =code-keyw ord> OF OBJ_USERROLEMAPPINGTYPE;

创建 替换
PROCEDURE USP_ADDEDILDELUSERMASTER


IN_USERROLEMAPPINGTYPE USERROLEMAPPINGTYPE

解决方案

据我所知,您无法将(.NET)数据表传递给Oracle存储过程(请记住.NET和SQL Server来自同一供应商,Oracle不是)



有很多方法 - 您可以将数据表转换为XML并传递它,或者您可以使用数据表的内容填充实际表,并让您的存储过程作用于该表。

as we can do in SQL how to pass datatable to oracle store proc

OracleParameter[] parameter ={
                                              new OracleParameter("IN_UserRoleMapping",dt)
                                          };



create or replace
TYPE OBJ_USERROLEMAPPINGTYPE AS OBJECT 
( 
"RoleId" NUMBER

)

create or replace
TYPE USERROLEMAPPINGTYPE 
AS TABLE OF  OBJ_USERROLEMAPPINGTYPE;

create or replace
PROCEDURE USP_ADDEDILDELUSERMASTER
(
  
  IN_USERROLEMAPPINGTYPE  USERROLEMAPPINGTYPE
 
)

解决方案

To the best of my knowledge you cannot pass a (.NET) datatable to an Oracle Stored Procedure (remember .NET and SQL Server are from the same vendor, Oracle is not)

There are ways around it - you could transform the datatable into XML and pass that, or you could populate an actual table with the contents of the datatable and have your stored procedure act on that table.


这篇关于如何从c#传递datatable到oracle存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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