none
can we update database useing commend bilder RRS feed

  • Question

  •  

    i have a database table, this table will have 15000 rows.

     

    i am taking this table in dataset useing data adapter.

     

    after got dataset i am assining some value to all rows.

     

    after updateing dataset

    i am useing

    ds.AcceptChanges()

     

    after done this and all i want to update this in the database

     

    if i upadte record by record in the database it will takeing lot of time, so performence of the application will bad, so i want to improve it.

     

    i added commend bilder for the dataadapter

     

    and at last

    da.update(ds)

    but it will not giveing correct out put.

     

    please give usefull tipes to do this, it is urgent

     

    thanks

    jayakumar 

    Tuesday, June 5, 2007 6:14 PM

Answers

  • Hi,


    Do not call AcceptChanges() until after you update your database. When you call AcceptChanges the original values used to lookup and update the rows in the database are overwritten with the current values. AcceptChanges should be called after you update the database.

     

    The command builder can only be used in certain situations. Please read this article and it will give you some background information on the command builder object. http://msdn2.microsoft.com/en-us/library/ms971491.aspx

     

    You can use the adapter to run the updates on the database in batches but setting the UpdateBatchSize property of the adapter. This will improve performance on updating your database. The number you set this to should not be the maximum number of rows you have but maybe a third of the records. Batching too many rows in an update has a negative performance impact.

     

     

    Tuesday, June 5, 2007 6:47 PM

All replies

  • Hi,


    Do not call AcceptChanges() until after you update your database. When you call AcceptChanges the original values used to lookup and update the rows in the database are overwritten with the current values. AcceptChanges should be called after you update the database.

     

    The command builder can only be used in certain situations. Please read this article and it will give you some background information on the command builder object. http://msdn2.microsoft.com/en-us/library/ms971491.aspx

     

    You can use the adapter to run the updates on the database in batches but setting the UpdateBatchSize property of the adapter. This will improve performance on updating your database. The number you set this to should not be the maximum number of rows you have but maybe a third of the records. Batching too many rows in an update has a negative performance impact.

     

     

    Tuesday, June 5, 2007 6:47 PM
  • tank you Derek Smyth it is working
    Tuesday, June 5, 2007 7:25 PM