static void Main(string[] args) { var conn = new ClickHouseConnection("Compress=True;CheckCompressedHash=False;Compressor=lz4;Host=192.168.10.110;Port=9000;Database=geekbuying;User=default;Password=;"); conn.Open(); CreateTable(conn); try { var user = new TestUser() { ResisterDate = DateTime.Now, ResisterTime = DateTime.Now, Age = 18, Name = "张三2" }; var user2 = new TestUser() { ResisterDate = DateTime.Now, ResisterTime = DateTime.Now, Age = 18, Name = "张三" }; // conn.Insert(user); Console.WriteLine("Insert single success."); conn.InsertBulk(new List <TestUser>() { user, user2 }); Console.WriteLine("Insert multi success."); } catch (Exception e) { Console.WriteLine(e.ToString()); } conn.Close(); }
public void TestInsertBulk() { var user = new TestUser() { ResisterDate = DateTime.Now, ResisterTime = DateTime.Now, Age = 18, Name = "уехЩ23" }; var user2 = new TestUser() { ResisterDate = DateTime.Now, ResisterTime = DateTime.Now, Age = 18, Name = "уехЩ3" }; var users = new List <TestUser>() { user, user2 }; conn.InsertBulk(users); }