Home All Groups Group Topic Archive Search About

Do I have to call DataSet.AcceptChanges() and commit

Author
5 Dec 2006 8:13 PM
Dan V.
Do I have to call AcceptChanges() every time I append my data row in the
procedure below: FillDataRow  OR  can I just call commit everytime?  thanks.


Simplified code below:
// ------------------------------------------------

myTrans =
vDataAdapter.InsertCommand.Connection.BeginTransaction(IsolationLevel.ReadCo
mmitted);
vDataAdapter.InsertCommand.Transaction = myTrans;

FillDataRow( blah blah blah ) ;

myTrans.Commit();

....



// -------------------------------------------------------

public Boolean FillDataRow(blah blah blah );

{

DataRow workrow;



workrow = tbl.NewRow();

workrow["blah1"] = blah1;

workrow["blah2"] = blah2;

tbl.Rows.Add(workrow);

bDataAdapter.Update(vDataSet, tbl.TableName); // run SQL: insert statement

}

Author
6 Dec 2006 5:57 AM
Cor Ligthert [MVP]
Dan,

The DataAdapter has its inbuild acceptchanges for all rows that are
processed correct.

Cor

Show quote
"Dan V." <d***@yah.com> schreef in bericht
news:u5W6QnKGHHA.5000@TK2MSFTNGP03.phx.gbl...
> Do I have to call AcceptChanges() every time I append my data row in the
> procedure below: FillDataRow  OR  can I just call commit everytime?
> thanks.
>
>
> Simplified code below:
> // ------------------------------------------------
>
> myTrans =
> vDataAdapter.InsertCommand.Connection.BeginTransaction(IsolationLevel.ReadCo
> mmitted);
> vDataAdapter.InsertCommand.Transaction = myTrans;
>
> FillDataRow( blah blah blah ) ;
>
> myTrans.Commit();
>
> ...
>
>
>
> // -------------------------------------------------------
>
> public Boolean FillDataRow(blah blah blah );
>
> {
>
> DataRow workrow;
>
>
>
> workrow = tbl.NewRow();
>
> workrow["blah1"] = blah1;
>
> workrow["blah2"] = blah2;
>
> tbl.Rows.Add(workrow);
>
> bDataAdapter.Update(vDataSet, tbl.TableName); // run SQL: insert statement
>
> }
>
>

AddThis Social Bookmark Button