Jump to content

AM29000

Member
  • Posts

    3
  • Joined

  • Last visited

Awards

This user doesn't have any awards

AM29000's Achievements

  1. Bought a Pinebook Pro. Its kinda slow, but there is no fan, and its got an ARM CPU
  2. Quick solution for something at work yesterday class Program { static void Main(string[] args) { try { if (!File.Exists("[REMOVED].sqlite")) { SQLiteConnection.CreateFile("[REMOVED].sqlite"); using SQLiteConnection conn = new SQLiteConnection("Data Source=[REMOVED].sqlite;Version=3;"); conn.Open(); using SQLiteCommand comm = conn.CreateCommand(); comm.CommandText = @" CREATE TABLE '[REMOVED]' ( '[REMOVED]' [REMOVED], '[REMOVED]' [REMOVED], '[REMOVED]' [REMOVED], '[REMOVED]' [REMOVED], '[REMOVED]' [REMOVED], '[REMOVED]' [REMOVED] );"; comm.ExecuteNonQuery(); } DataTable dt = new DataTable(); using (SqlConnection conn = new SqlConnection("[REMOVED]")) { conn.Open(); using SqlCommand comm = new SqlCommand("[REMOVED]", conn); using SqlDataAdapter da = new SqlDataAdapter(comm); da.Fill(dt); } ParallelOptions parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount }; Parallel.ForEach(dt.AsEnumerable(), parallelOptions, dtRow => { LogThis(dtRow); }); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } static void LogThis(DataRow dr) { try { List<SQLiteParameter> SqlParams = new List<SQLiteParameter> { new SQLiteParameter("$[REMOVED]", dr["[REMOVED]"]), new SQLiteParameter("$[REMOVED]", dr["[REMOVED]"]), new SQLiteParameter("$[REMOVED]", dr["[REMOVED]"]), new SQLiteParameter("$[REMOVED]", dr["[REMOVED]"]), }; using SQLiteConnection conn = new SQLiteConnection("Data Source=[REMOVED].sqlite;Version=3;"); conn.Open(); using SQLiteCommand comm = conn.CreateCommand(); comm.CommandText = @"[REMOVED]"; foreach (SQLiteParameter param in SqlParams) { comm.Parameters.Add(param); } comm.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }
×