Data Tables REPost

Discussion in 'ASP .Net Web Controls' started by Brian Shannon, Jul 12, 2004.

  1. I posted this question on Friday and haven't received a response. If I need
    to add more content for clarification please ask:

    My current solution works but I am looking to find if there is a more
    efficient way of inserting multiple records from a data table to a DB.

    I create a datatable tostore information in as my program is running. When
    the program is finished I have about 20 records in the datatable.

    I now need to insert these records into an sql2000 DB. I loop through the
    table to insert 1 record at a time using the sqlcommand ExecuteNonQuery().

    Is there a way to insert all the records from a datatable in 1 statement
    to the DB? Here I am making 20 calls the my DB inserting 1 record at a
    time. Hopefully there is a more efficient way.

    If you need more info or more clarification please ask!

    Thanks
     
    Brian Shannon, Jul 12, 2004
    #1
    1. Advertising

  2. have a look at the batch update for the provider, it may be what you are
    looking for.

    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
    Got tidbits? Get it here... http://tinyurl.com/27cok
    "Brian Shannon" <> wrote in message
    news:%...
    >I posted this question on Friday and haven't received a response. If I
    >need
    > to add more content for clarification please ask:
    >
    > My current solution works but I am looking to find if there is a more
    > efficient way of inserting multiple records from a data table to a DB.
    >
    > I create a datatable tostore information in as my program is running.
    > When
    > the program is finished I have about 20 records in the datatable.
    >
    > I now need to insert these records into an sql2000 DB. I loop through the
    > table to insert 1 record at a time using the sqlcommand ExecuteNonQuery().
    >
    > Is there a way to insert all the records from a datatable in 1 statement
    > to the DB? Here I am making 20 calls the my DB inserting 1 record at a
    > time. Hopefully there is a more efficient way.
    >
    > If you need more info or more clarification please ask!
    >
    > Thanks
    >
    >
     
    Alvin Bruney [MVP], Jul 12, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Adams
    Replies:
    1
    Views:
    396
    =?Utf-8?B?U2hhaWxlc2ggSmFubnU=?=
    Aug 26, 2004
  2. Adam Knight

    REPOST - Parent List Data Item!

    Adam Knight, Nov 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    370
    Adam Knight
    Nov 21, 2005
  3. Peter Bassett
    Replies:
    3
    Views:
    947
    Augustus
    Aug 15, 2003
  4. Otuatail

    Tables within tables

    Otuatail, Jul 31, 2004, in forum: HTML
    Replies:
    7
    Views:
    510
  5. Chris Brat
    Replies:
    5
    Views:
    709
    =?iso-8859-1?q?Luis_M._Gonz=E1lez?=
    Aug 22, 2006
Loading...

Share This Page