public long SqlBulkCopyInsert(DataTable dt) { string strCon = dba.GetConn(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(strCon); sqlBulkCopy.DestinationTableName = "G_DPoint"; sqlBulkCopy.BatchSize = dt.Rows.Count; SqlConnection sqlConn = new SqlConnection(strCon); sqlConn.Open(); if (dt != null && dt.Rows.Count != 0) { sqlBulkCopy.WriteToServer(dt); } sqlBulkCopy.Close(); sqlConn.Close(); stopwatch.Stop(); return(stopwatch.ElapsedMilliseconds); }