bulk insert to SQL server table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eranby
    New Member
    • Aug 2007
    • 17

    bulk insert to SQL server table

    Hi,

    I'm trying to insert Datatable into my SQL table named TA100
    I'm using this code :

    Code:
     public void refreshTable(DataTable freshData)
            {
                //con is the sql connection which is already open
                SqlBulkCopy copy = new SqlBulkCopy(con);
                copy.DestinationTableName = "TA100";
                copy.WriteToServer(freshData);
            }
    the connection is open and close out of the method.
    the table is not infected from this action.
    I tryed in many other ways uselessly.
    I can't even execute simple "insert into" query (the result is not affect the table)
    does anyone have any suggestions?

    thanks Eran
    Last edited by Curtis Rutland; Nov 3 '08, 02:42 PM. Reason: added code tags
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    Please refer this Article regarding your question.

    Comment

    Working...