How to?

  • Thread starter Thread starter Jacek Jurkowski
  • Start date Start date
J

Jacek Jurkowski

Release row from a table?

DataRow row = Table.Rows[0].Copy? Clone?
 
Jacek Jurkowski said:
Release row from a table?

DataRow row = Table.Rows[0].Copy? Clone?

Table.Rows.Remove(Table.Rows[0]) or Table.Rows.RemoveAt(0)?
 
Note that this will remove the row from the collection, and it will not
be processed if passed to a data adapter.

If you want the effect of marking the row for delete and having the data
adapter deleting the row in the underlying data source, then you should call
the Delete method on the DataRow itself.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Family Tree Mike said:
Jacek Jurkowski said:
Release row from a table?

DataRow row = Table.Rows[0].Copy? Clone?

Table.Rows.Remove(Table.Rows[0]) or Table.Rows.RemoveAt(0)?
 
Nicholas Paldino said:
Note that this will remove the row from the collection, and it will not
be processed if passed to a data adapter.

If you want the effect of marking the row for delete and having the data
adapter deleting the row in the underlying data source, then you should call
the Delete method on the DataRow itself.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Family Tree Mike said:
Jacek Jurkowski said:
Release row from a table?

DataRow row = Table.Rows[0].Copy? Clone?

Table.Rows.Remove(Table.Rows[0]) or Table.Rows.RemoveAt(0)?

Good point. I wasn't even sure if I had the question interpreted correctly
though...
 
The problem is that with Remove() row looses its data ...
I want to get a row (with data) from one table and add
it into another table ...

Family Tree Mike said:
Jacek Jurkowski said:
Release row from a table?

DataRow row = Table.Rows[0].Copy? Clone?

Table.Rows.Remove(Table.Rows[0]) or Table.Rows.RemoveAt(0)?
 
I have only ever itterated over the items in a row, and stored them to a row
in the other table that was created there. The chances of two tables being
identical is remote, so the matching up of fields would be done by your code.

Jacek Jurkowski said:
The problem is that with Remove() row looses its data ...
I want to get a row (with data) from one table and add
it into another table ...

Family Tree Mike said:
Jacek Jurkowski said:
Release row from a table?

DataRow row = Table.Rows[0].Copy? Clone?

Table.Rows.Remove(Table.Rows[0]) or Table.Rows.RemoveAt(0)?
 

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

Back
Top