public static void BuildFromDatabase(string server, string db, string table, string column, IAdd t) { DuplicateDetector.Clear(); t.BeginUpdate(); SqlConnection connection = new SqlConnection(Util.GetConnectionString(server, db)); connection.Open(); string q = TrieQuery(db, table, column); SqlCommand sqlcmd = new SqlCommand(q, connection); sqlcmd.CommandTimeout = 0; int count = 0; using (SqlDataReader reader = sqlcmd.ExecuteReader()) { while (reader.Read()) { count++; if (count == 10) { Console.Write(""); //break; } string s = reader.GetString(0); if (DuplicateDetector.ContainsKey(s)) { if (count % 10000 == 0) { Console.WriteLine("{1}: Inserted {0} records", count, DateTime.Now); } continue; } DuplicateDetector.Add(s, true); t.Add(s); if (count % 10000 == 0) { Console.WriteLine("{1}: Inserted {0} records", count, DateTime.Now); } } } connection.Close(); t.EndUpdate(); }