public static void PerformBulkCopy() { string connectionString = "Server=CBMWEBREN15;Database=jahan;Trusted_Connection=true"; { try { SqlConnection sourceConnection = new SqlConnection(connectionString); SqlCommand myCommand = new SqlCommand("select * from j22", sourceConnection); sourceConnection.Open(); SqlDataReader myReader = myCommand.ExecuteReader(); SqlConnection destinationConnection = new SqlConnection(connectionString); destinationConnection.Open(); SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection.ConnectionString); bulkCopy.BatchSize = 40; bulkCopy.NotifyAfter = 30; bulkCopy.SqlRowsCopied += new SqlRowsCopiedEventHandler(bulkCopy_SqlRowsCopied); bulkCopy.DestinationTableName = "j2"; bulkCopy.WriteToServer(myReader); destinationConnection.Close(); myReader.Close(); sourceConnection.Close(); } catch (Exception ex) { throw ex; } }
the above code is working but is there any possible to get dataset from arraylist and store it to database using bulkcopy... if u know means tel me
mySqlDataAdapter.Update(myDataSet,"TableName");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)