What's Better? Adding Incomplete DataRows or Leaving Detached

  • Thread starter Thread starter jehugaleahsa
  • Start date Start date
J

jehugaleahsa

Hello:

We wrote an entire application where we add our DataRows to our
DataTables immediately. However, we have to shut off our constraints
to do this. We would like to use detached DataRows to circumvent this.

What do you normally do to track detached DataRows? Is there a way to
retrieve them? or do I have to stored them in some temporary location?

Thanks for any input!
~Travis
 
Hello:

We wrote an entire application where we add our DataRows to our
DataTables immediately. However, we have to shut off our constraints
to do this. We would like to use detached DataRows to circumvent this.

What do you normally do to track detached DataRows? Is there a way to
retrieve them? or do I have to stored them in some temporary location?

Thanks for any input!
~Travis

Let me make sure I understand: So you're using "detached" DataRows
stored in a collection of some sort outside your DataTable because if
you added them to your DataTable it would violate an existing
constraint and you want to know what the best way is to track deteched
DataRows in general. There's just not enough context to the question
to give a very useful answer, but I would imagine the worst solution
would be circumventing the restraints on your DataTable.

Can you provide more detail?
 
Let me make sure I understand: So you're using "detached" DataRows
stored in a collection of some sort outside your DataTable because if
you added them to your DataTable it would violate an existing
constraint and you want to know what the best way is to track deteched
DataRows in general. There's just not enough context to the question
to give a very useful answer, but I would imagine the worst solution
would be circumventing the restraints on your DataTable.

Can you provide more detail?

Well, no, I can't. My question is very open. I know people use
DataTables to track changes on their UIs.

I want to know how they track DataRows that haven't been added to the
DataTable. If you don't store them somewhere, I don't know how to get
them back. I am curious whether people store them in a List<DataRow>
or if there is a more elegant solution.

Plain curiousity on how to do it.

Thanks,
Travis
 
I have used DataRowVersion to find changes to rows in a DataTable.

-rusty








- Show quoted text -

How can I quickly iterate over detached rows and add them to my
DataTable?
 
How can I quickly iterate over detached rows and add them to my
DataTable?- Hide quoted text -

- Show quoted text -

I'm not sure I understand the question, but in general you add a
DataRow to a DataTable with DataTable.Rows.Add(DataRow) method. This
implies that the row can be added to the table. Basically the row you
are adding has to have identical columns as the DataTable, I think.

You would have to describe what it is you want to iterate through.
Are these datarows part of a collection or array?

-rusty
 
I'm not sure I understand the question, but in general you add a
DataRow to a DataTable with DataTable.Rows.Add(DataRow) method.   This
implies that the row can be added to the table.  Basically the row you
are adding has to have identical columns as the DataTable, I think.

You would have to describe what it is you want to iterate through.
Are these datarows part of a collection or array?

-rusty- Hide quoted text -

- Show quoted text -

I suppose my original question was: How do the Windows Form controls
hold detached rows, such as the DataGridView. I realized after some
research that the BindingSource keeps track of a single detached row
automatically. When the next detached row is added, the current
detached row is added. If you use the controls, the detached rows are
tracked for you. Otherwise, you have to manage the detached rows
yourself. There is no way to query a DataTable for all of its detached
rows.
 
I suppose my original question was: How do the Windows Form controls
hold detached rows, such as the DataGridView. I realized after some
research that the BindingSource keeps track of a single detached row
automatically. When the next detached row is added, the current
detached row is added. If you use the controls, the detached rows are
tracked for you. Otherwise, you have to manage the detached rows
yourself. There is no way to query a DataTable for all of its detached
rows.- Hide quoted text -

- Show quoted text -

I see. I'm going to look into that (which rows were added). One
thing that you should be able to do is capture an event where a new
row is added and track that way.
-rusty
 
Back
Top