There's quite a nice technique you can use: build a batch of insert commands
and execute them all at once. If the number of rows is small (hundred or
"Robbe Morris [C# MVP]" <info@eggheadcafe.com> wrote in message
news:%23UcDQg5bFHA.1404@TK2MSFTNGP09.phx.gbl...
>I suspect that you may be better off not using a DataSet at all.
> Perhaps an ArrayList of your own data classes. An array
> if you know the exact amount of records.
>
> Theoretically, the one row at a time calling the stored
> procedure should be faster. The DataSet is eventually
> going send each row one at a time anyway.
>
> --
> 2004 and 2005 Microsoft MVP C#
> Robbe Morris
>
http://www.masterado.net >
> Earn $$$ money answering .NET Framework
> messageboard posts at EggHeadCafe.com.
>
http://www.eggheadcafe.com/forums/merit.asp >
>
>
> "Kenny M." <KennyM@discussions.microsoft.com> wrote in message
> news:97E5C944-D2A3-482A-9C67-AABA49469181@microsoft.com...
>> Well I first make the comparison and if that is ok I copy the row into
>> the
>> Data Set
>>
>> My question is:
>>
>> Should I send the row to the SP to insert at this time? I mean one y One?
>>
>> The row has 6 column to be saved, and I 'm looking the faster
>> performance,
>> millseconds are important to me.
>>
>> thks
>> --
>> Kenny M.
>>
>>
>> "Robbe Morris [C# MVP]" wrote:
>>
>>> The DataSet still sends these one row at a time by
>>> creating the appropriate InsertCommand,UpdateCommand, or
>>> DeleteCommand.
>>>
>>> The DataSet not being run against a stored procedure is
>>> probably a little slower. Would it drastically impact
>>> your app? Depends on how many columns you
>>> are updating and various other items.
>>>
>>> You may want to consider retrieving the comparison
>>> values first, then deleting rows from the DataSet
>>> that don't comply, then .Update your DataSet.
>>>
>>>
>>>
>>> --
>>> 2004 and 2005 Microsoft MVP C#
>>> Robbe Morris
>>>
http://www.masterado.net >>>
>>> Earn $$$ money answering .NET Framework
>>> messageboard posts at EggHeadCafe.com.
>>>
http://www.eggheadcafe.com/forums/merit.asp >>>
>>>
>>>
>>> "Kenny M." <KennyM@discussions.microsoft.com> wrote in message
>>> news:DEC3636F-1AA7-439C-8EB2-F0635CD39D8B@microsoft.com...
>>> >I have heard that the most time consuming task into a DB is the when we
>>> >use
>>> > the Insert Statatement,
>>> >
>>> > Is that true?
>>> >
>>> > Ok I have an application that sends from 10 to 500 rows to the DB,
>>> > those
>>> > rows are compared again a fixed value and then they are inserted to
>>> > the DB
>>> > if
>>> > the comparison is ok.
>>> >
>>> > I would like to do all that inside the DB (a SP) but I don't know how,
>>> > so
>>> > I
>>> > created a WebService to do that, my point is that I'm not inserting
>>> > row by
>>> > row instead I hold the rows in a Dataset (memory) and later I make one
>>> > big
>>> > insert to the DB.
>>> >
>>> > My question is should I leave that code like this or should go to the
>>> > DB
>>> > in
>>> > order to insert row by row to gain some performance?
>>> >
>>> > Can you think a better way to do that, because that is the heart of my
>>> > app
>>> > and I want to minimize the time it takes.
>>> >
>>> > Thnks.
>>> >
>>> > --
>>> > Kenny M.
>>>
>>>
>>>
>
>