Building Dataset from Class Array

G

Guest

Forgive any bad terms. New to .Net development

My business layer has something similiar to this

class Accoun
private m_Notes as Note(

' Get Mehod
..
end clas

Class Not
private m_strText as Strin
private m_dCreateDate as Dat

' Get Method
..
' Load Function
..
End Clas

My question is this. Obviously I have a array of Notes objects within my Account object. From prior ASP.NET experience I know I want to have a DataSet of Notes for the Presentation layer. Is there a standard way to produce or store the dataset

It doesn't make too much sense to me to have a Member Function in Accounts that builds a Dataset from the Notes array but am not sure of alternatives

I apologize for the double post (one in the public forums) I am new to the Managed Groups

TIA
- Marc Castrechini
 
S

Steven Cheng[MSFT]

Hi Marc,

Thanks for posting in the community!
From your description, you're looking for some suggestions on generate
DataSet(DataTable and recoreds) from existing Class Instances. Also, these
classes has relations with each other such as Master-Detail.. ,yes?
If there is anything I misunderstood, please feel free to let me know.

Based on my experience, if you used untyped dataset, you may need to create
the dataset and DataTables and manually create datarow and set the datas
in your class instance into row. However, the typed DataSet maybe more
suitable for you, it can provide more object-oriented operations on
manipulating data(insert , update ,delete). Do data manipulate on typed
dataset is just like on a certain class's instance collection. Here are
some tech references and articles on typed dataset:

#Walkthrough: Creating a Dataset with Tables, Keys, and One-to-Many
Relationships
http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkWalkthroughCreatingX
MLSchemaWithOne-to-ManyRelationship.asp?frame=true

#Creating Typed Dataset
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconADONETDataSetCreatio
nInVisualStudioNET.asp?frame=true

#Working with a Typed DataSet
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconworkingwithtypedda
taset.asp?frame=true

#Implementing Data Transfer Object in .NET with a Typed DataSet
http://msdn.microsoft.com/library/en-us/dnpatterns/html/ImpDTOtypedDataSet.a
sp?frame=true

Please check out the above items. Hope they are helpful.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
M

Marc Castrechini

Found it.

If anyone is curious:

This is pretty easily done by creating a collection using CollectionBase as
seen here:
http://msdn.microsoft.com/library/d...systemcollectionscollectionbaseclasstopic.asp

Then using standard data binding with the collection.

- Marc

Marc Castrechini said:
Forgive any bad terms. New to .Net development.

My business layer has something similiar to this:

class Account
private m_Notes as Note()

' Get Mehods
...
end class

Class Note
private m_strText as String
private m_dCreateDate as Date

' Get Methods
...
' Load Functions
...
End Class

My question is this. Obviously I have a array of Notes objects within my
Account object. From prior ASP.NET experience I know I want to have a
DataSet of Notes for the Presentation layer. Is there a standard way to
produce or store the dataset?
It doesn't make too much sense to me to have a Member Function in Accounts
that builds a Dataset from the Notes array but am not sure of alternatives.
 
S

Steven Cheng[MSFT]

Hi Marc,

Thanks for your response and I'm glad that you've found the good solution.
Also thanks a lot for sharing your solution with us. Anyway, if you need
any help next time, please always feel free to post here.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top