StrataFrame Forum

Add an overload to NewRow

http://forum.strataframe.net/Topic9410.aspx

By Paul Chase - 6/7/2007

Would it be possible to add an overload to NewRow to allow a datarow to be passed in? 

Thanks

Paul

By Trent L. Taylor - 6/7/2007

Why don't you just use the CopyDataFrom method on the BO because if you already have another DataRow it has to come from another DataTable.  You can append to the current data table rather than overwriting all of the internal data.  You will then have to set that row to Added:

CurrentRow.SetAdded()

You could also add an overload yourself by creating your own BO base class that inherits from the BusinessLayer then you inherit your BOs off of that class which has the NewRow overload you are expecting.

We can add this to the list, but it won't make it into 1.6.1. Smile

By Paul Chase - 6/7/2007

Trent,

No problem on when it gets in. I have it as an overloads in my base bus layer but i was just worried about if you change something in newrow might break my overload.

On the CopyDatafrom method does that copy the entire data data table or just the current row?

By Trent L. Taylor - 6/7/2007

On the CopyDatafrom method does that copy the entire data data table or just the current row?

You can have it copy from the DataTable or the DataView.  So if you use the DataView you could filter out just that one record then the CopyDataFrom would only move in that one record.  This is the second parameter of the CopyDataFrom method that specifies the data that will be copied in and from where.

FYI....all DataTables already have a view attached to them so this is the view that will be used when using that option:

MyDataTable.DefaultView
By Paul Chase - 6/7/2007

Thanks Trent that helps I am trying to something like scatter memvar in foxpro where I am on a record and copy it to memory change the values of a few fields and then insert it back in the same table.
By Trent L. Taylor - 6/7/2007

Yeah...you just have to be careful of primary keys....just like you did in FoxPro Smile
By Paul Chase - 6/7/2007

It already yelled at me about thatHehe
By Trent L. Taylor - 6/7/2007

BigGrin Yeah, it'll get ya Smile