[英]oracle connection into c# ssis script task
I have a connection manager that points to an oracle database.I then need to use that said connection into a ssis script task.I don't know how to proceed.I tried something and I got an error message could you help me.Here is my code: I also tried with those connection string: 我有一个指向oracle数据库的连接管理器。然后我需要将该连接用于ssis脚本任务。我不知道如何继续。我尝试了一些东西,我得到了一条错误信息,你能不能帮帮我。这里是我的代码:我也试过这些连接字符串:
// SqlConnection conn = new SqlConnection("Data Source=SOURCE;User ID=user_GG;Provider=OraOLEDB.Oracle.1;Persist Security Info=True;");
SqlConnection oracleConn = new SqlConnection("Data Source=PRONMPIA;Persist Security Info=True;Integrated Security=yes;");
oracleConn.Open();
using (SqlCommand command = new SqlCommand("SELECT count(*) FROM random.table", oracleConn))
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
int name = reader.GetInt32(0);
MessageBox.Show("SALUT " + name.ToString() );
}
}
oracleConn.Close();
MessageBox.Show(" test succes");
Dts.TaskResult = (int)ScriptResults.Success;
You are trying to use SqlConnection
which is a .Net component for SQL Server, not for Oracle. 您正在尝试使用SqlConnection
,它是SQL Server的.Net组件,而不是Oracle。 You need the Oracle.DataAccess.Client
and the OracleConnection
. 您需要Oracle.DataAccess.Client
和OracleConnection
。 To use that you need to add the Oracle .Net provider to the References
of the Script
task (see project explorer References node when editing the script task .Net code), Add Oracle.DataAccess
, then in you code " using Oracle.DataAccess.Client;
". 要使用它,您需要将Oracle .Net提供程序添加到Script
任务的References
(编辑脚本任务.Net代码时参见项目资源管理器引用节点),添加Oracle.DataAccess
,然后在代码中“ using Oracle.DataAccess.Client;
“。 HTH HTH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.