C# 大批量 数据 高效导入 oracle 【急!!!!!】
在网上找了一个例子
http://www.cnblogs.com/isline/archive/2010/08/31/1813722.html
但是老是报错,
一会儿报错:内存溢出,一会儿报错连接中断,等等……
【【请问有没有可行的解决办法?】】
<%@ WebHandler Language="C#" Class="import" %>
using System;
using System.Web;
using Oracle.DataAccess.Client;
public class import : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
HttpRequest request = context.Request;
HttpResponse response = context.Response;
response.ContentType = "text/plain";
string outStr = ""; //服务器返回信息
int recc = 1000;
outStr = Import(recc);
response.Write(outStr);
response.End();
}
public string Import(int recc)
{
string connectionString = Maticsoft.DBUtility.PubConstant.ConnectionString;
string SQLString = "insert into HBS_XZQ(pkid,districts,percapitagdp,age) values (S_HBS_XZQ.Nextval,:districts,:percapitagdp,:age)";
using (OracleConnection connection = new OracleConnection(connectionString))
{
using (OracleCommand cmd = new OracleCommand(SQLString, connection))
{
//这个参数需要指定每次批插入的记录数
cmd.ArrayBindCount = recc;
try
{
connection.Open();
//以数组作为参数
//下面定义几个数组,分别表示三个字段,数组的长度由参数直接给出
int[] dedistricts = new int[recc];
int[] dePercapitagdp = new int[recc];
int[] deAge = new int[recc];
// 为了传递参数,不可避免的要使用参数,下面会连续定义三个
&n