using (SqlConnection con = new SqlConnection(strConnect)) { con.Open(); using (SqlBulkCopy BCtest = new SqlBulkCopy(con)) { BCtest.DestinationTableName = "Test"; DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Columns.Add("Data"); dt.Rows.Add("ID 1", "DATA 1"); dt.Rows.Add("ID 2", "DATA 2"); dt.Rows.Add("ID 3", "DATA 3"); dt.Rows.Add("ID 4", "DATA 4"); bulk.WriteToServer(dt); } }
No comments:
Post a Comment