Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

A Place to share c#.Net script which are useful to developers

Moderators

C#.NET Scripts

C# - Script to bulk copy a datatable to a sql server table

Jul 27 2012 12:00AM by Ramireddy   

While inserting multiple rows into a database table, smartest approach is to use bulk copy mechanism. .NET framework has SqlBulkCopy class to copy the rows in bulk to a sql server database table. Following script will be useful in the scenario.

public static void bulkCopyIntoTable(DataTable dtData,string sDatabaseTableName,string sConnectionString)
        {

            using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sConnectionString))
            {
                bulkCopy.DestinationTableName = sDatabaseTableName;
                try
                {
                    // Write from the source to the destination.
                    bulkCopy.WriteToServer(dtData);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {

                }
            }
        }


Ramireddy
2 · 41% · 12972
2
 
0
Worked
 
0
Failed
 
0
Lifesaver
 
0
Production
 
0
Unwise



Submit

Your Comment


Sign Up or Login to post a comment.

"C# - Script to bulk copy a datatable to a sql server table" rated 5 out of 5 by 2 readers
C# - Script to bulk copy a datatable to a sql server table , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]