Question about DataRows/DataGrids

R

rustyryan

Hey all, I have a question about using DataRows (and ultimately, its
interplay with a DataGrid)

So I create my DataSet, create a DataTable, configure it with columns
and then add rows like so:
(C++ .NET)
DataTable* table; //assume setup
DataRow* row = table->NewRow();

//columns 0,1, and 2 are all setup in the table
row->set_Item(0,fi->get_Name()); //assume fi->GetName() returns
some string*
row->set_Item(1,S"Queued");
row->set_Item(2, S"---");
table->get_Rows()->Add(row);

After I have added the row to the table, can I still use the DataRow
object to change data in the row, or is this a no-no ? Do I need to
wrap the changes with calls to DataRow::BeginEdit and DataRow::EndEdit?

After I have added the DataTable to the DataSet and, set a DataGrid to
refer to the DataSet and display the DataTable I setup, can I still
change stuff then?

If I do, what is the proper way to update things? Should I call
DataGrid::Update()?

I'm dealing with some nasty problems where I get the "No original data"
error from my datagrid while I'm updating literally all the rows in the
table by just directly referring to the DataRow object I got from
DataTable::NewRow() in the beginning.

tia,
rj ryan
 
G

Guest

I am not sure but don't you have to AcceptChanges() to the dataset after
adding new rows to the table. This way the rows will take the state of
original. Of course if you have to report changes to a database then you have
no way to know what was changed but worth a try and maybe code to keep track
of additions
 

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

Top