Creating an object from another

hog

Senior Contributor
Joined
Mar 17, 2003
Messages
984
Location
UK
Hi,

if object A has six rows of data within it and I want to create six new objects each using one row from object A is there a way to do it?

If I use object1 = objectA I obviously get all rows returned in objectA.

If I move to each row within objectA then try the same line I get all rows.......obviously

I need to modify each row as a single entity.....

Might be being dump here but ADO and objects are fairly new to me as VB.Net so forgive what might be a stupid question :-(
 
theres no such thing as stupid questions just stupid people :) (no i'm not calling you stupid lol)

My best guess would be that an assignment statement isn't what you are looking for here... maybe you should look at a loop to set the properties of an object individually...
I wish i would have finished my ADO book by now and i'd be able to help more... I think there is a method there that returns a single row but i don't know...

until you can find that holy graile.. i'd suggest using a round about technique until you do find the right solution.

although the guys here are pretty good someone is bound to know
 
Visual Basic:
Dim resultRows as DataRow() 'This is an array of rows


resultRows = myOriginalTable.Select(vbnullstring) ' you could have entered any SQL WHERE clause here
 
Hi,

what I did was to create a new constructor which has two parameters passed to it from objectA which allows for the identification of each row, this creates six new objects using each seperate row within objectA.

Not sure if this is the most efficient way to go about it......but it works!
 
Back
Top