//연결정보 웹 콘피그 내용
string connectionString = "Data Source=XXX;Initial Catalog=XXX;User Id=XXX;Password=XXX;Application Name=TEST";
System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(connectionString);
try
{
connection.Open();
System.Data.SqlClient.SqlBulkCopy oBulk = new System.Data.SqlClient.SqlBulkCopy(connection);
oBulk.DestinationTableName = "XXXX.dbo.MyDataValues"; //자기가 연은 카탈로그에서 실행
oBulk.BatchSize = 10000;
DataTable dtUpd = new DataTable();
dtUpd.Columns.Add("MyDataID", typeof(string));
dtUpd.Columns.Add("ColSeq", typeof(Int16));
dtUpd.Columns.Add("RowSeq", typeof(int));
dtUpd.Columns.Add("ColVal", typeof(string));
DataRow row;
foreach (var vrListIn in pList)
{
row = dtUpd.NewRow();
row["MyDataID"] = vrListIn.MyDataID;
row["ColSeq"] = vrListIn.ColSeq;
row["RowSeq"] = vrListIn.RowSeq;
row["ColVal"] = vrListIn.ColVal;
dtUpd.Rows.Add(row);
}
oBulk.WriteToServer(dtUpd);
oBulk.Close();
dtUpd = null;
}
catch (Exception ex)
{
}
finally
{
if (connection != null)
{
connection.Close();
}
}