string strData = "Accented chars- Les caractères accentués français "; DataTable dtTemp = new DataTable( ); dtTemp.Columns.Add( "ID", typeof( string ) ); dtTemp.Columns.Add( "Value", typeof( string ) ); DataRow dr = dtTemp.NewRow( ); dr[ "ID" ] = "100"; dr[ "Value_Code" ] = strData; dtTemp.Rows.Add( dr ); strSQLCon = GetSQLConnectionString( ); using ( SqlConnection cn = new SqlConnection( strSQLCon ) ) { cn.Open( ); using ( SqlBulkCopy copy = new SqlBulkCopy( cn ) ) { copy.ColumnMappings.Add( "ID", "ID" ); copy.ColumnMappings.Add( "Value", "Value" ); copy.DestinationTableName = "MTABLE"; copy.WriteToServer( dtTemp ); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)