Insert elements from an array into table? RRS feed

  • Question

  • Dear all,

    I have a table with over 500 fields, name of the fields are F1, F2, ....F500.

    How can i insert from an array, or loop through the fields to insert?

    I've looked for solution in MSDN and find the statement:


    INSERT INTO dbf_name FROM ARRAY ArrayName | FROM MEMVAR | FROM NAME ObjectName


     However, it's used for Visual FoxPro in VS2005.

    I'm using VS C#, Entity FrameWork. 

    Pls help me.


    Thursday, July 14, 2011 3:24 PM


  • Since each field is a column if your table is in the same order you can use the bulkcopy object


    first convert your array into a dataset then create the bulkcopy pointing to the table that you need to insert into.


    then simply run the writetoserver(dataset) function and it will fly into your sql database

    • Marked as answer by hungdoan Monday, July 18, 2011 2:54 PM
    Monday, July 18, 2011 1:34 PM

All replies