[Vista tip] Search folders e il gadget sidebar "Presentazione"

La questione in gioco è la seguente:

Come definire un elenco di immagini da presentare nella side bar, all'interno di una più ampia collezione di imagini ?

Poichè la configurazione del gadget prevede la possibilità di selezionare una sola cartella (ed eventualmente le sue sottocartelle) la prima (orrenda) soluzione che mi è venuta in mente è stata quella creare una cartella e dentro tale cartella creare i collegamenti alle immagini.

Presentazione2 (<<< da NON fare!!!)

Poi mi sono ricordato di una feature di Vista, le cartelle di ricerca. Ed ecco cosa ho fatto:

  1. Ho aperto "Raccolta foto Windows", ho selezionato alcune foto e gli ho aggiunto il tag "Sidebar" (potete usare qualunque nome, anche "pippo" se volete...):
    image
  2. Mi sono posizionato nella cartella Immagini e ho cercato tutte le immagini che hanno come tag "Sidebar". Per farlo basta posizionarsi nella cartella immagini e inserire nel campo di ricerca "tag:(Sidebar)":

    image   
  3. Ho salvato la ricerca nella cartella Sidebar (che ho creato dentro la cartella immagini):
    image  
  4. Ho aperto la configurazione del gadget "Presentazione", ho selezionato la cartella "C:\User\<yourName>\Pictures\Sidebar" e ho settato l'opzione "Includi sottocartelle":
    Presentazione1

Et voilà, il gioco è fatto!

Ora, per togliere ed aggiungere foto al "Carosello di presentazione", mi basta mettere e/o togliere il tag "Sidebar" alle immagini tramite il programma "Raccolta foto Windows".

Chiaramente le immagini dovranno risiedere nella cartella immagini o nelle sue sottocartelle, visto che la ricerca si basa su di esse. Se volete la massima libertà (a costo di una minore performance) ampliate la ricerca a tutto il computer ampliando inoltre il vincolo di ricerca a tutte le cartelle (indicizzate e non). Oppure fate una ricerca ad hoc per il vostro specifico caso.

Un'ultima considerazione: non è possibile selezionare direttamente la cartella di ricerca come cartella da visualizzare nella Presentazione. E' per questo che, come workaround, ho creato una cartella contenitore (la Immagini\SideBar) per la cartella di ricerca e l'ho utilizzata come cartella da visualizzare, settando l'opzione "Includi sottocartelle".

Sperando di aver fatto cosa utile, porgo i miei saluti!

Libri che sto leggendo

E' tempo di aggiornare l'elenco dei libri che sto leggendo...

ProAdoNet2.0

Eccezionale veramente: andate a vedere cosa ne pensa Bill Ryan:

Essentially what I mean by this is that he covers stuff that real developers are confronted with over and over everday.  He intentionally focuses on problem areas and how to address them.

HeadFirstDesignPatterns 

Al momento non oso comentarlo (l'ho appena iniziato). Posso solo dire che sono un addicted della "Head First". Mi sa che comprerò altri libri di questa serie.

IE 8: On the Path to Web Standards Compliance - ACID 2 Test Pass Complete

Acid2 Face

Un'interessante intervista al General Manager Dean Hachamovitch e al Main Architect Chris Wilson su IE8 su Channel 9, in occasione di un importante risultato: la build interna del 12/12/07 di IE8 è in grado di renderizzare correttamente la faccetta del test Acid2.

Tanto per intenderci, ad oggi la situazione è la presente (tratto da Wikipedia - Acid2):

 Hello world 1 Acid2 as rendered by Internet Explorer 6.0

 Hello world 2 Acid2 as rendered by Internet Explorer 7.0

 Hello world 3 Acid2 as rendered by Mozilla Firefox 1.0, Mozilla 1.7.13, and Netscape 7.2

 Hello world 4 Acid2 as rendered by Mozilla Firefox 1.5, and 2.0, , and Netscape 9

Nell'intervista viene spiegato che non hanno "riparato" qualche bugs, ma hanno dovuto rivedere molte parti di IE e implementare molte nuove features per poter eseguire correttamente il test Acid2. Inoltre IE8 supporterà (molto meglio di IE7) la compatibilità verso quei siti ottimizzati per IE6 e IE7.

Al momento non sono riuscito a capire per quando sia prevista l'uscita di IE8, ma immagino che per MIX 08 se ne saprà parecchio di più.

Kudos per team di sviluppo IE8!

SqlBulkCopy at work

Dopo aver provato vari metodi di importazione di un file dati in formato testo in un database, come meglio descritto nel mio precedente post Importare un file di testo in SQL Server (Ce ed Express), ho effettuato anche le prove con SqlBulkCopy.

Questi i risultati:

Using SQL Server Express Edition
====================================================================

BulkCopy step 1 of 2 (read textfile to a DataTable)..: 00.01.22.1578
BulkCopy step 2 of 2 (write DataTable to the DB).....: 00.01.34.4933
--------------------------------------------------------------------
BulkCopy total elapsed time..........................: 00.02.56.6511

Deleting imported table..............................: 00.01.28.9116

BulkCopy from textFileDataReader (batch size 0)......: 00.02.59.3999

Deleting imported table..............................: 00.01.18.3308

BulkCopy from textFileDataReader (batch size 100.000): 00.02.40.1774

Deleting imported table..............................: 00.00.55.0827

BulkCopy from textFileDataReader (batch size 10.000).: 00.01.26.5775

Deleting imported table..............................: 00.00.29.8098

BulkCopy from textFileDataReader (batch size 1.000)..: 00.01.35.7437

Deleting imported table..............................: 00.00.21.8374

BulkCopy from textFileDataReader (batch size 100)....: 00.02.59.1883

Da cui deriva che:

Importare in una DataTable e poi fare la bulk copy equivale a fare la bulk copy passandogli direttamente lo stesso iDataReader  utilizzato per riempire la DataTable (2' 56" Vs. 2' 59");

Di default l'istanza sqlBulkCopy ha la proprietà BatchSize impostata a zero, ossia raggruppa tutte le operazioni di inserimento in un unico comando sql insert (e bisogna settare la proprietà BulkCopyTimeout a un numero di secondi sufficiente per completare l'operazione), ma non è sempre l'imposazione ottimale. Dalle prove fatte, in questo caso, il risultato migliore si ottiene con batch size 10.000 .

Riassumendo le varie prove fatte abbiamo:

Using SQL Server Compact Edition
====================================================================
Import from text file (modify cmd each iteration)....: 00.11.29.9476

Deleting imported table..............................: 00.00.43.3449

Import from text file (with param and cmd prepare)...: 00.06.05.5234

Deleting imported table..............................: 00.00.43.6101

Transactional import from text file..................: 00.06.23.0232

Transactional deleting imported table................: 00.00.43.2467

Direct table import from text file (ResultSet).......: 00.06.22.4188

Deleting imported table..............................: 00.00.43.3742

Using SQL Server Express Edition
====================================================================

Import from text file (modify cmd each iteration)....: 00.37.19.1644

Deleting imported table..............................: 00.01.49.0421

Import from text file (with param and cmd prepare)...: 00.32.54.1606

Deleting imported table..............................: 00.00.40.2665

Transactional import from text file..................: 00.08.30.1257

Transactional deleting imported table................: 00.00.17.2543

BulkCopy step 1 of 2 (read textfile to a DataTable)..: 00.01.22.1578
BulkCopy step 2 of 2 (write DataTable to the DB).....: 00.01.34.4933
--------------------------------------------------------------------
BulkCopy total elapsed time..........................: 00.02.56.6511

Deleting imported table..............................: 00.01.28.9116

BulkCopy from textFileDataReader (batch size 0)......: 00.02.59.3999

Deleting imported table..............................: 00.01.18.3308

BulkCopy from textFileDataReader (batch size 100.000): 00.02.40.1774

Deleting imported table..............................: 00.00.55.0827

BulkCopy from textFileDataReader (batch size 10.000).: 00.01.26.5775

Deleting imported table..............................: 00.00.29.8098

BulkCopy from textFileDataReader (batch size 1.000)..: 00.01.35.7437

Deleting imported table..............................: 00.00.21.8374

BulkCopy from textFileDataReader (batch size 100)....: 00.02.59.1883

I risultati suddetti sono comunque da prendere con le molle perchè ho ancora dei dubbi:

  • Che parte gioca il Garbage Collector nei primi metodi? (Probabilmente si potrebbe ottenere dei risparmi ri-utilizzando una string builder)
  • Perchè abbiamo risultati notevolmente differenti nelle varie chiamate a "Deleting imported table" ?

Comunque, per chi volesse vederli, i sorgenti sono in questo post (che non ho "affisso" al muro UgiDotNet per non dar fastidio).

Buone feste!

Sorgenti del test di importazione file txt in SQL Server

Sorgente delle prove con SQL Server Compact Edition:

namespace ConsoleLoadToSQL { class TextToSqlCe { private Stopwatch stopWatch; public Stopwatch StopWatch { get { return stopWatch; } } public String TimeElapsed { get { if (stopWatch != null) { return (new DateTime(stopWatch.ElapsedTicks)).ToString("HH.mm.ss.ffff"); } else { return "-.--.-- (null reference)"; } } } public void LoadDataSimpleCommand() { string sourceConnectionString = Properties.Settings.Default.CBDataLogConnectionString; string destConnectionString = Properties.Settings.Default.WeightsConnectionString; using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT * FROM CBDataLog.txt;", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); if (textFileDataReader.HasRows) { // Open the destination connection and insert directly to the SQLCe table using (SqlCeConnection destinationConnection = new SqlCeConnection(destConnectionString)) { destinationConnection.Open(); try { SqlCeCommand cmd = new SqlCeCommand(); cmd.Connection = destinationConnection; stopWatch = Stopwatch.StartNew(); while (textFileDataReader.Read()) { cmd.CommandText = "INSERT INTO DataLog (LogLine) VALUES ('" + textFileDataReader.GetValue(0).ToString() + "')"; cmd.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection objects are automatically closed at the end // of the using blocks. } } } } } public void LoadData() { string sourceConnectionString = Properties.Settings.Default.CBDataLogConnectionString; string destConnectionString = Properties.Settings.Default.WeightsConnectionString; using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT * FROM CBDataLog.txt;", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); if (textFileDataReader.HasRows) { // Open the destination connection and insert directly to the SQLCe table using (SqlCeConnection destinationConnection = new SqlCeConnection(destConnectionString)) { destinationConnection.Open(); try { SqlCeCommand cmd = new SqlCeCommand(); cmd.Connection = destinationConnection; cmd.CommandText = "INSERT INTO DataLog (LogLine) VALUES (?)"; cmd.Parameters.Add("@logLine", System.Data.SqlDbType.NVarChar); cmd.Prepare(); stopWatch = Stopwatch.StartNew(); while (textFileDataReader.Read()) { cmd.Parameters[0].Value = textFileDataReader.GetValue(0).ToString(); cmd.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection objects are automatically closed at the end // of the using blocks. } } } } } public void EmptyData() { string destConnectionString = Properties.Settings.Default.WeightsConnectionString; using (SqlCeConnection destinationConnection = new SqlCeConnection(destConnectionString)) { destinationConnection.Open(); try { SqlCeCommand cmd = new SqlCeCommand(); cmd.Connection = destinationConnection; cmd.CommandText = "DELETE DataLog"; cmd.Prepare(); stopWatch = Stopwatch.StartNew(); ; cmd.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); // The connection objects are automatically closed at the end // of the using blocks. } } } public void LoadDataWithTransaction() { string sourceConnectionString = Properties.Settings.Default.CBDataLogConnectionString; string destConnectionString = Properties.Settings.Default.WeightsConnectionString; using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT * FROM CBDataLog.txt;", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); if (textFileDataReader.HasRows) { // Open the destination connection and insert directly to the SQLCe table using (SqlCeConnection destinationConnection = new SqlCeConnection(destConnectionString)) { destinationConnection.Open(); SqlCeTransaction destTransaction = destinationConnection.BeginTransaction(); try { SqlCeCommand cmd = new SqlCeCommand(); cmd.Connection = destinationConnection; cmd.Transaction = destTransaction; cmd.CommandText = "INSERT INTO DataLog (LogLine) VALUES (?)"; cmd.Parameters.Add("@logLine", System.Data.SqlDbType.NVarChar); cmd.Prepare(); stopWatch = Stopwatch.StartNew(); while (textFileDataReader.Read()) { cmd.Parameters[0].Value = textFileDataReader.GetValue(0).ToString(); cmd.ExecuteNonQuery(); } destTransaction.Commit(); } catch (Exception ex) { destTransaction.Rollback(); Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection objects are automatically closed at the end // of the using blocks. } } } } } public void EmptyDataWithTransaction() { string destConnectionString = Properties.Settings.Default.WeightsConnectionString; using (SqlCeConnection destinationConnection = new SqlCeConnection(destConnectionString)) { destinationConnection.Open(); SqlCeTransaction destTransaction = destinationConnection.BeginTransaction(); try { SqlCeCommand cmd = new SqlCeCommand(); cmd.Connection = destinationConnection; cmd.Transaction = destTransaction; cmd.CommandText = "DELETE DataLog"; cmd.Prepare(); stopWatch = Stopwatch.StartNew(); cmd.ExecuteNonQuery(); destTransaction.Commit(); } catch (Exception ex) { destTransaction.Rollback(); Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); // The connection objects are automatically closed at the end // of the using blocks. } } } public void LoadDataWithResultSet() { string sourceConnectionString = Properties.Settings.Default.CBDataLogConnectionString; string destConnectionString = Properties.Settings.Default.WeightsConnectionString; using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT * FROM CBDataLog.txt;", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); if (textFileDataReader.HasRows) { // Open the destination connection and insert directly to the SQLCe table using (SqlCeConnection destinationConnection = new SqlCeConnection(destConnectionString)) { destinationConnection.Open(); try { SqlCeCommand cmd = new SqlCeCommand(); cmd.Connection = destinationConnection; cmd.CommandText = "DemoInsert"; cmd.CommandType = System.Data.CommandType.TableDirect; SqlCeResultSet rs = cmd.ExecuteResultSet(ResultSetOptions.Updatable); SqlCeUpdatableRecord rec = rs.CreateRecord(); cmd.CommandText = "INSERT INTO DataLog (LogLine) VALUES (?)"; cmd.Parameters.Add("@logLine", System.Data.SqlDbType.NVarChar); cmd.Prepare(); stopWatch = Stopwatch.StartNew(); while (textFileDataReader.Read()) { rec.SetString(1, textFileDataReader.GetValue(0).ToString()); rs.Insert(rec); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection objects are automatically closed at the end // of the using blocks. } } } } } } }

Sorgente delle prove con SQL Server Express:

namespace ConsoleLoadToSQL { class TextToSqlExpress { private DataTable sourceDataTable; private String sourceConnectionString; private String destConnectionString; private Stopwatch stopWatch; public Stopwatch StopWatch { get { return stopWatch; } } public String TimeElapsed { get { if (stopWatch != null) { return (new DateTime(stopWatch.ElapsedTicks)).ToString("HH.mm.ss.ffff"); } else { return "-.--.-- (null reference)"; } } } public TextToSqlExpress() { sourceDataTable = new DataTable(); sourceDataTable.Columns.Add("LogLine", typeof(String)); sourceConnectionString = Properties.Settings.Default.CBDataLogConnectionString; destConnectionString = Properties.Settings.Default.WeightsSqlExpressConnectionString; } public void LoadDataSimpleCommand() { using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT * FROM CBDataLog.txt", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); if (textFileDataReader.HasRows) { using (SqlConnection destinationConnection = new SqlConnection(destConnectionString)) { destinationConnection.Open(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = destinationConnection; stopWatch = Stopwatch.StartNew(); while (textFileDataReader.Read()) { cmd.CommandText = "INSERT INTO dbo.DataLog (LogLine) VALUES ('" + textFileDataReader.GetValue(0).ToString() + "')"; cmd.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection objects are automatically closed at the end // of the using blocks. } } } } } public void LoadData() { using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT * FROM CBDataLog.txt", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); if (textFileDataReader.HasRows) { using (SqlConnection destinationConnection = new SqlConnection(destConnectionString)) { destinationConnection.Open(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = destinationConnection; cmd.CommandText = "INSERT INTO dbo.DataLog (LogLine) VALUES (@logLine)"; cmd.Parameters.Add("@logLine", System.Data.SqlDbType.NVarChar, 200); cmd.Prepare(); stopWatch = Stopwatch.StartNew(); while (textFileDataReader.Read()) { cmd.Parameters[0].Value = textFileDataReader.GetValue(0).ToString(); cmd.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection objects are automatically closed at the end // of the using blocks. } } } } } public void EmptyData() { using (SqlConnection destinationConnection = new SqlConnection(destConnectionString)) { destinationConnection.Open(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = destinationConnection; cmd.CommandText = "DELETE FROM dbo.DataLog"; cmd.CommandTimeout = 240; cmd.Prepare(); stopWatch = Stopwatch.StartNew(); ; cmd.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); // The connection objects are automatically closed at the end // of the using blocks. } } } public void LoadDataWithTransaction() { using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT * FROM CBDataLog.txt", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); if (textFileDataReader.HasRows) { using (SqlConnection destinationConnection = new SqlConnection(destConnectionString)) { destinationConnection.Open(); SqlTransaction destTransaction = destinationConnection.BeginTransaction(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = destinationConnection; cmd.Transaction = destTransaction; cmd.CommandText = "INSERT INTO dbo.DataLog (LogLine) VALUES (@logLine)"; cmd.Parameters.Add("@logLine", System.Data.SqlDbType.NVarChar, 200); cmd.Prepare(); stopWatch = Stopwatch.StartNew(); while (textFileDataReader.Read()) { cmd.Parameters[0].Value = textFileDataReader.GetValue(0).ToString(); cmd.ExecuteNonQuery(); } destTransaction.Commit(); } catch (Exception ex) { destTransaction.Rollback(); Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection objects are automatically closed at the end // of the using blocks. } } } } } public void EmptyDataWithTransaction() { using (SqlConnection destinationConnection = new SqlConnection(destConnectionString)) { destinationConnection.Open(); SqlTransaction destTransaction = destinationConnection.BeginTransaction(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = destinationConnection; cmd.Transaction = destTransaction; cmd.CommandText = "DELETE FROM dbo.DataLog"; cmd.Prepare(); stopWatch = Stopwatch.StartNew(); cmd.ExecuteNonQuery(); destTransaction.Commit(); } catch (Exception ex) { destTransaction.Rollback(); Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); // The connection objects are automatically closed at the end // of the using blocks. } } } public void LoadSourceDataTable() { using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT LogLine FROM CBDataLog.txt", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); try { stopWatch = Stopwatch.StartNew(); sourceDataTable.Load(textFileDataReader); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); textFileDataReader.Close(); // The connection object is automatically closed at the end // of the using block. } } } public void BulkCopy() { using (SqlConnection destinationConnection = new SqlConnection(destConnectionString)) { destinationConnection.Open(); using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection, SqlBulkCopyOptions.TableLock, null)) { try { SqlBulkCopyColumnMapping colMapping1 = new SqlBulkCopyColumnMapping("LogLine", "LogLine"); // bulkCopy.BatchSize = 100; bulkCopy.BulkCopyTimeout = 600; bulkCopy.ColumnMappings.Add(colMapping1); bulkCopy.DestinationTableName = "dbo.DataLog"; // bulkCopy.SqlRowsCopied += new SqlRowsCopiedEventHandler(bulkCopy_SqlRowsCopied); // bulkCopy.NotifyAfter = 1000; stopWatch = Stopwatch.StartNew(); bulkCopy.WriteToServer(sourceDataTable); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stopWatch.Stop(); // The SqlBulkCopy object is automatically closed at the end // of the using block. // The destination connection object is automatically closed at the end // of the using block. } } } } public void BulkCopyFromIDataReader(int batchSize) { using (OdbcConnection sourceConnection = new OdbcConnection(sourceConnectionString)) { sourceConnection.Open(); OdbcCommand commandSourceData = new OdbcCommand("SELECT LogLine FROM CBDataLog.txt", sourceConnection); OdbcDataReader textFileDataReader = commandSourceData.ExecuteReader(); using (SqlConnection destinationConnection = new SqlConnection(destConnectionString)) { destinationConnection.Open(); using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection, SqlBulkCopyOptions.TableLock, null)) { try { bulkCopy.BatchSize = batchSize; bulkCopy.BulkCopyTimeout = 600; // 10 min should be enougth even with batch size = 0 ... SqlBulkCopyColumnMapping colMapping1 = new SqlBulkCopyColumnMapping("LogLine", "LogLine"); bulkCopy.ColumnMappings.Add(colMapping1); bulkCopy.DestinationTableName = "dbo.DataLog"; // bulkCopy.SqlRowsCopied += new SqlRowsCopiedEventHandler(bulkCopy_SqlRowsCopied); // bulkCopy.NotifyAfter = bulkCopy.BatchSize; stopWatch = Stopwatch.StartNew(); bulkCopy.WriteToServer(textFileDataReader); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { textFileDataReader.Close(); stopWatch.Stop(); // The SqlBulkCopy object is automatically closed at the end // of the using block. // The source connection object is automatically closed at the end // of the using block. } } } } } //void bulkCopy_SqlRowsCopied(object sender, SqlRowsCopiedEventArgs e) //{ // Console.WriteLine(); // Console.WriteLine(String.Format("{0} Rows have been copied.", e.RowsCopied.ToString())); //} } }
«dicembre»
domlunmarmergiovensab
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345