如何将数据从DataTable插入到Oracle Database Table: [英] How to Insert Data from DataTable to Oracle Database Table :
问题描述
我在 DataTable
中有2行3列的数据.我想将该数据插入到 Oracle
表中.
I've data in DataTable
with 2 rows and 3 columns. I want to insert that data into Oracle
table.
如何插入?请举个例子.
How can I insert? please give me with some example.
还有
如何将数据表传递到 ORACLE ...
How can I pass datatable to storedprocedure in ORACLE...
我以下面提到的方式传递了数据表,但是数据表类型问题来了.我该如何解决?
I pass datatable in below mensioned manner, but datatable type problem is comming. how can I solve this?
cmd.Parameters.Add("@Details",dtSupplier);
(OR)
cmd.Parameters.Add("Details", DbType.Single).Value = dtSupplier.ToString();
推荐答案
想要将数据集或数据表插入ORACLE,
want to insert dataset or a datatable into ORACLE,
- 创建一个ORACLE数据适配器.
- 创建要插入的命令对象,
- 将CommandType设置为StoredProcedure.
- 数据适配器的更新命令,
- 将数据集或数据表作为参数传递.
像这样:
OracleDataAdapter da = new OracleDataAdapter();
OracleCommand cmdOra = new OracleCommand(StoredProcedureName, Connection);
cmdOra.CommandType = CommandType.StoredProcedure;
da.InsertCommand = cmdOra;
da.Update(dsDataSet);
OR
如果上述方法不起作用,不如将数据表作为xml参数传递而比处理它
if above dont work than pass datatable as xml prameter than than process it
For details check : ADO.NET DataTable as XML parameter to an Oracle/SQL Server Database Stored Procedure
OR
在Oracle网站上检查此线程:线程:将数据表传递给Oracle存储过程
Check this thread on Oracle site : Thread: Pass data table to Oracle stored procedure
检查现有答案:如何将数据表作为输入到C#中的过程?
这篇关于如何将数据从DataTable插入到Oracle Database Table:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!