OdbcConnection odbc_conn = new OdbcConnection(_cs_odbc); SqlConnection sql_conn = new SqlConnection(_cs_sql);
odbc_conn.Open();
sql_conn.Open();
using (OdbcCommand odbccmd = new OdbcCommand(odbc_cmd, odbc_conn))
{
odbccmd.CommandTimeout = 30;
using (OdbcDataReader dr = odbccmd.ExecuteReader())
{
SqlBulkCopyOptions options =
SqlBulkCopyOptions.CheckConstraints |
SqlBulkCopyOptions.FireTriggers |
SqlBulkCopyOptions.UseInternalTransaction;
using (SqlBulkCopy s = new SqlBulkCopy(sql_conn,options,null))
{
s.DestinationTableName = _table;
s.BatchSize = 100;
s.BulkCopyTimeout = 900;
s.NotifyAfter = 1;
s.SqlRowsCopied += s_SqlRowsCopied;
s.WriteToServer(dr);
s.Close();
}
}
}
odbc_conn.Close();
sql_conn.Close();
I use this code to bulk copy data from odbc-->sql, and in some situations I run it over a VPN link (odbc on one side, sql on the other)-- it there a way to compress this data on the fly? right in the c# code?