I want to pass a few thousand records to a SQLce database and then insert them in a table
Seems like the fastest way to do it (sql server replication not an option) is to pass a recordset that has all the records marked as DataRowState.Added, then use a dataadapter.update on the recordset

Walking through the dataset and using insert commands was slower

Is there a way quickly change all the rows in a dataset to "added" or to have them marked as added (rather than unchanged) when the dataset is first filled

thanks

Re: Changing DataRow Rowstate progamatically by Mortos

Mortos
Thu Mar 04 11:54:41 CST 2004

Have a look at the 'SourceVersion' of the command object. See if that
gives you some ideas. How are you populating the DataTable initially? If
you can create a DataTable and then 'add' the rows via one of the
DataTable.Rows.Add() overrides (thinking specifically of the object[]),
that should give you rows with a RowState of 'Added'.

Suck it and See!!!

Chuck wrote:

> I want to pass a few thousand records to a SQLce database and then insert them in a table.
> Seems like the fastest way to do it (sql server replication not an option) is to pass a recordset that has all the records marked as DataRowState.Added, then use a dataadapter.update on the recordset.
>
> Walking through the dataset and using insert commands was slower.
>
> Is there a way quickly change all the rows in a dataset to "added" or to have them marked as added (rather than unchanged) when the dataset is first filled.
>
> thanks,
>
>

--
I AM MORTOS!!!! (Switch spammer with blueyonder)

Re: Changing DataRow Rowstate progamatically by Ravi[MSFT]

Ravi[MSFT]
Thu Mar 04 12:17:49 CST 2004

In current version of DataSet, there is no provision of changing row state
from unchanged to added. However, when you fill the dataset with
SqlDataAdapter, there is a property called AcceptChangesDuringFill that you
can set which will indicate whether to the SqlDataAdapter that it has to do
"AcceptChanges" after the rows have been populated. By default this property
is set to "true". So when you fill the rows with the adapter you'd see the
rows in "unchanged" state by default. By setting AcceptChangesDuringFill
property to "false" you can keep the rows in the Added state.

HTH,
Ravi

"Chuck" <anonymous@discussions.microsoft.com> wrote in message
news:31DC557B-138F-4DFB-B878-204DBB707A58@microsoft.com...
> I want to pass a few thousand records to a SQLce database and then insert
them in a table.
> Seems like the fastest way to do it (sql server replication not an option)
is to pass a recordset that has all the records marked as
DataRowState.Added, then use a dataadapter.update on the recordset.
>
> Walking through the dataset and using insert commands was slower.
>
> Is there a way quickly change all the rows in a dataset to "added" or to
have them marked as added (rather than unchanged) when the dataset is first
filled.
>
> thanks,
>
>