using KdbndpConnection conn = new KdbndpConnection("Host=192.168.133.221;Port=54321;Database=db1;Pooling=true;User ID=system;Password=123");
conn.Open();
//存储过程调用也是类似
using var cmd = conn.CreateCommand();
cmd.CommandText = "模式.包名称.存储过程名称";
cmd.CommandType = CommandType.StoredProcedure;
//参数1是普通入参
var p1 = cmd.CreateParameter();
p1.ParameterName = "p1";
p1.Direction = ParameterDirection.Input;
p1.Value = "123";
cmd.Parameters.Add(p1);
//参数2是一个select结果的游标
var p2 = cmd.CreateParameter();
p2.ParameterName = "Resultlist";
p2.Direction = ParameterDirection.Output;
p2.KdbndpDbType = KdbndpTypes.KdbndpDbType.Refcursor;
cmd.Parameters.Add(p2);
//执行
cmd.ExecuteNonQuery();
//游标数据获取
var curName = p2.Value;
cmd.CommandText = $"fetch all in \"{curName}\"";
cmd.CommandType = CommandType.Text;
//生成dt
DataTable dt = new DataTable();
using var adp = new KdbndpDataAdapter(cmd);
adp.Fill(dt);
官网下载的包有问题,使用这个包就ok文章来源:https://www.toymoban.com/news/detail-847370.html
https://download.csdn.net/download/pehao/89077002文章来源地址https://www.toymoban.com/news/detail-847370.html
到了这里,关于人大金昌netcore适配,调用oracle模式下存储过程\包,返回参数游标的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!