static void Main(string[] args) { CreatedDB createdDB = new CreatedDB() { Reporter = new ConsoleReporter() }; CreateTableDB createTableDB = new CreateTableDB() { Reporter = new ConsoleReporter() }; DropDataBase dropDataBase = new DropDataBase(); createdDB.CreatedDataBase(); createTableDB.CreateTable(); Console.WriteLine("\n\nНажмите любую клавишу"); Console.ReadKey(); int choice = 0; while (choice == 0) { Console.Clear(); Console.WriteLine("\nУдалить БД?\n 1 - да\n 2 - нет"); int.TryParse(Console.ReadLine(), out choice); switch (choice) { case 1: dropDataBase.Drop(); Console.WriteLine("БД удалена!!!"); break; case 2: break; default: choice = 0; continue; } } Console.ReadKey(); }
//リストビューのアップデート private void UpdateListView(DropDataBase.DropDataSummarize summary) { var listitem = summary.Rows.Select(delegate(DropDataBase.DropDataSummarizeRow row) { ListViewItem item = new ListViewItem(); var rowtext = row.MakeListViewRow(); item.Text = rowtext[0]; item.SubItems.AddRange(rowtext.Skip(1).ToArray()); item.Tag = row.CorrespondingRecord; return item; }); //リストビューの操作部分 listView_output.BeginUpdate(); foreach (var i in Enumerable.Range(0, Math.Min(summary.Headers.Length, listView_output.Columns.Count))) listView_output.Columns[i].Text = summary.Headers[i];//ヘッダー listView_output.Items.Clear(); listView_output.Items.AddRange(listitem.ToArray()); listView_output.EndUpdate(); }