How to delete a row in table?

  • Thread starter Thread starter bigsyq
  • Start date Start date
B

bigsyq

code:

ObjDs.Tables(0).Rows.Remove(objRow)

ObjDa.Update(ObjDs, "diary")

Why can not deleted?
 
Use 'Delete' method, not Remove.

When you use Remove, it does just that, remove the Row completely, When you
use delete, it marks the row for deletion and when you run the update, it
removes the row from the table and from the database.

Regards - OHM



code:

ObjDs.Tables(0).Rows.Remove(objRow)

ObjDa.Update(ObjDs, "diary")

Why can not deleted?

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
Hi Bigsyq

Use the delete methode

When you do the update and you have made (using the commandbuilder or direct
by making your own sql delete command) it removes the information in the row
from the database.

When you do dataset.acceptchanges after that, it removes that information
from the dataset.
(Although when you are using it, and the row is marked as delete you don't
see it normaly either).

I hope this helps

Cor
 
Back
Top