我正在尝试使用批量复制将数据从sql发送到oracle。 这是代码
string sqldb = "server=DOR-SQLTEST\\DORSQLSERVER;" + "initial catalog=RD2KTEST;" + "user id=amehra;" + "password=Research@322";
SqlConnection sqlconn = new SqlConnection(sqldb);
sqlconn.Open();
string sqlstring="select TOP 10 POSITION_ID, POSITION_DESC from T_CD_POSITION";
SqlCommand scmd = new SqlCommand(sqlstring, sqlconn);
SqlDataReader reader = scmd.ExecuteReader();
while(reader.Read())
{
Console.WriteLine("entered to write to oracle.......\n\n");
string oradb = "Data Source=UHAMPTST;user id=ocg_de;password=rd2k";
OracleConnection oraconn = new OracleConnection(oradb);
oraconn.Open();
Console.WriteLine("orca conn established....");
using( OracleBulkCopy orca_bulk_copy = new OracleBulkCopy(oraconn))
{
orca_bulk_copy.DestinationTableName = "t_test_postion";
orca_bulk_copy.WriteToServer(reader);//line 38
orca_bulk_copy.Close();
orca_bulk_copy.Dispose();
}
}
}
}
}
由于Oracle异常发生,我在第38行遇到错误。 请妥善解决问题