Deleting Multiple Rows

S

Stephen Noronha

Hi,

I want to delete multiple records/rows from a dataset for eg:
DataSet.tables(0).rows("Some Counter").delete() will delete one row.
what if I have to delete more than one row...

Thanks,
Stephen
 
M

Marshal Antony

Hi Stephan,
You can delete multiple rows by using a loop.
Eg :

DataSet ds=new DataSet();

populate dataset..

for(int i=0;i<ds.Tables[0].Rows.Count;i++)

{

ds.Tables[0].Rows.Delete();

}

This will delete all rows from a datatable(first one) in the dataset
..

If you want to delete multiple rows based on some condition,put the if
condition inside the for loop before deletion.

HTH

Regards,

Marshal Antony

..NET Developer

http://www.dotnetmarshal.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,142
Messages
2,570,818
Members
47,362
Latest member
eitamoro

Latest Threads

Top