Hi,
I want a fast way to use assign a tha values in a DataTable to a
collection/Array/List of Classes. Each record in my DataTable should be new
Class, and tha Class would have property's for each Field in the DataTable.
Is something like this possible? Or how should I do something like this?
A more practical exemple:
I have a Class clsCustomer, which contains many orders: so a
Collection/Array/List of the clsOrder.
So with the CustomerID, I want to have the whole Collection/Array/List of
the clsOrder of this Customer...
Thanks a lot in advance,
Pieter 7 1231
Take a look into CollectionBase class
public class FeederCollectio n : CollectionBase
Regards
Jignesh Desai - MVP
Blogs @ http://dotnetjini.jigneshdesai.com/Blogs/default.aspx
..NET Training Programs : http://dotnetjini.jigneshdesai.com/Training.aspx
"DraguVaso" <pi**********@h otmail.com> wrote in message
news:uF******** ******@tk2msftn gp13.phx.gbl... Hi,
I want a fast way to use assign a tha values in a DataTable to a collection/Array/List of Classes. Each record in my DataTable should be
new Class, and tha Class would have property's for each Field in the
DataTable. Is something like this possible? Or how should I do something like this?
A more practical exemple: I have a Class clsCustomer, which contains many orders: so a Collection/Array/List of the clsOrder. So with the CustomerID, I want to have the whole Collection/Array/List of the clsOrder of this Customer...
Thanks a lot in advance,
Pieter
Huh? What are you talking about? I din't find anything about a
"FeederCollecti on"? even when looking for it on google I din't find any
website!!
Are you sure that you write it like that? because I don't get a clue?
"Jignesh Desai" <ji***********@ hotmail.com> wrote in message
news:ei******** ******@TK2MSFTN GP14.phx.gbl... Take a look into CollectionBase class public class FeederCollectio n : CollectionBase
Regards Jignesh Desai - MVP Blogs @ http://dotnetjini.jigneshdesai.com/Blogs/default.aspx .NET Training Programs : http://dotnetjini.jigneshdesai.com/Training.aspx
"DraguVaso" <pi**********@h otmail.com> wrote in message news:uF******** ******@tk2msftn gp13.phx.gbl... Hi,
I want a fast way to use assign a tha values in a DataTable to a collection/Array/List of Classes. Each record in my DataTable should be new Class, and tha Class would have property's for each Field in the DataTable. Is something like this possible? Or how should I do something like this?
A more practical exemple: I have a Class clsCustomer, which contains many orders: so a Collection/Array/List of the clsOrder. So with the CustomerID, I want to have the whole Collection/Array/List
of the clsOrder of this Customer...
Thanks a lot in advance,
Pieter
Pieter,
Assuming that you mean with classes instanced objects, than in my opinion is
your class on the same level as the arraylist or whatever.
And therefore is in my opinion just a for loop from the datatable, something
as
Dim myarraylist as new arraylist
For each row as datarow in myDatatable
dim myObject as new myClassBeNeLux
MyObject.TheCou ntry = col("Country")
if MyObject.TheCou ntry = "Belgium" then
MyObject.Correc tRoute = "Probably false"
end if
Next
In my opinion you cannot do it quicker using reflection or something what
you maybe expect You can maybe make a shorter routine using that, however
the processing time will probably be longer. You know something the same as
directing almost everybody except the first over a wrong route.
:-)
Cor
"DraguVaso" <pi**********@h otmail.com> schreef in bericht
news:uF******** ******@tk2msftn gp13.phx.gbl... Hi,
I want a fast way to use assign a tha values in a DataTable to a collection/Array/List of Classes. Each record in my DataTable should be new Class, and tha Class would have property's for each Field in the DataTable.
Is something like this possible? Or how should I do something like this?
A more practical exemple: I have a Class clsCustomer, which contains many orders: so a Collection/Array/List of the clsOrder. So with the CustomerID, I want to have the whole Collection/Array/List of the clsOrder of this Customer...
Thanks a lot in advance,
Pieter
hello dragu,
sounds like you want to do O/R-mapping (object-relational-mapping). (Google
for that word for more help on this topic)
But maybe a typed dataset is just what you want. With a typed dataset you
can access the value of each column through a property.
regards,
Felix
"DraguVaso" <pi**********@h otmail.com> schrieb im Newsbeitrag
news:uS******** *****@TK2MSFTNG P10.phx.gbl... Huh? What are you talking about? I din't find anything about a "FeederCollecti on"? even when looking for it on google I din't find any website!! Are you sure that you write it like that? because I don't get a clue?
"Jignesh Desai" <ji***********@ hotmail.com> wrote in message news:ei******** ******@TK2MSFTN GP14.phx.gbl... Take a look into CollectionBase class public class FeederCollectio n : CollectionBase
Regards Jignesh Desai - MVP Blogs @ http://dotnetjini.jigneshdesai.com/Blogs/default.aspx .NET Training Programs : http://dotnetjini.jigneshdesai.com/Training.aspx
"DraguVaso" <pi**********@h otmail.com> wrote in message news:uF******** ******@tk2msftn gp13.phx.gbl... > Hi, > > I want a fast way to use assign a tha values in a DataTable to a > collection/Array/List of Classes. Each record in my DataTable should be new > Class, and tha Class would have property's for each Field in the DataTable. > > Is something like this possible? Or how should I do something like > this? > > A more practical exemple: > I have a Class clsCustomer, which contains many orders: so a > Collection/Array/List of the clsOrder. > So with the CustomerID, I want to have the whole Collection/Array/List of > the clsOrder of this Customer... > > Thanks a lot in advance, > > Pieter > >
Hehe ok thanks :-)
And your example was really nice and to the point! Great! (*tssssssssss*)
hehe :-)
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. Pieter,
Assuming that you mean with classes instanced objects, than in my opinion
is your class on the same level as the arraylist or whatever.
And therefore is in my opinion just a for loop from the datatable,
something as
Dim myarraylist as new arraylist For each row as datarow in myDatatable dim myObject as new myClassBeNeLux MyObject.TheCou ntry = col("Country") if MyObject.TheCou ntry = "Belgium" then MyObject.Correc tRoute = "Probably false" end if Next
In my opinion you cannot do it quicker using reflection or something what you maybe expect You can maybe make a shorter routine using that, however the processing time will probably be longer. You know something the same
as directing almost everybody except the first over a wrong route.
:-)
Cor
"DraguVaso" <pi**********@h otmail.com> schreef in bericht news:uF******** ******@tk2msftn gp13.phx.gbl... Hi,
I want a fast way to use assign a tha values in a DataTable to a collection/Array/List of Classes. Each record in my DataTable should be new Class, and tha Class would have property's for each Field in the DataTable.
Is something like this possible? Or how should I do something like this?
A more practical exemple: I have a Class clsCustomer, which contains many orders: so a Collection/Array/List of the clsOrder. So with the CustomerID, I want to have the whole Collection/Array/List
of the clsOrder of this Customer...
Thanks a lot in advance,
Pieter
DraguVaso wrote: Hi,
I want a fast way to use assign a tha values in a DataTable to a collection/Array/List of Classes. Each record in my DataTable should be new Class, and tha Class would have property's for each Field in the DataTable.
Is something like this possible? Or how should I do something like this?
A more practical exemple: I have a Class clsCustomer, which contains many orders: so a Collection/Array/List of the clsOrder. So with the CustomerID, I want to have the whole Collection/Array/List of the clsOrder of this Customer...
Thanks a lot in advance,
Pieter
Dragu.
There is a solution using Reflection to map your column names to your
property name. It is a little in-depth but if you want to go down this
route, let me know.
Regards
Ray
Thanks! That object-relational-mapping stuf seems really nice to me! I have
to look a little bit further into that subject!
"Felix Braun" <fe*@nexgo.de > wrote in message
news:ui******** ******@tk2msftn gp13.phx.gbl... hello dragu,
sounds like you want to do O/R-mapping (object-relational-mapping).
(Google for that word for more help on this topic)
But maybe a typed dataset is just what you want. With a typed dataset you can access the value of each column through a property.
regards, Felix
"DraguVaso" <pi**********@h otmail.com> schrieb im Newsbeitrag news:uS******** *****@TK2MSFTNG P10.phx.gbl... Huh? What are you talking about? I din't find anything about a "FeederCollecti on"? even when looking for it on google I din't find any website!! Are you sure that you write it like that? because I don't get a clue?
"Jignesh Desai" <ji***********@ hotmail.com> wrote in message news:ei******** ******@TK2MSFTN GP14.phx.gbl... Take a look into CollectionBase class public class FeederCollectio n : CollectionBase
Regards Jignesh Desai - MVP Blogs @ http://dotnetjini.jigneshdesai.com/Blogs/default.aspx .NET Training Programs :
http://dotnetjini.jigneshdesai.com/Training.aspx
"DraguVaso" <pi**********@h otmail.com> wrote in message news:uF******** ******@tk2msftn gp13.phx.gbl... > Hi, > > I want a fast way to use assign a tha values in a DataTable to a > collection/Array/List of Classes. Each record in my DataTable should
be new > Class, and tha Class would have property's for each Field in the DataTable. > > Is something like this possible? Or how should I do something like > this? > > A more practical exemple: > I have a Class clsCustomer, which contains many orders: so a > Collection/Array/List of the clsOrder. > So with the CustomerID, I want to have the whole
Collection/Array/List of > the clsOrder of this Customer... > > Thanks a lot in advance, > > Pieter > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andreas Klemt |
last post by:
Hello,
let's say my session("myDataTable") is type of DataTable
Now what is faster?
a) Dim dv As New DataView(session("myDataTable"))
b) Dim dv As New DataView(CType(session("myDataTable"), DataTable))
Which should I use and which is better?
|
by: DraguVaso |
last post by:
Hi,
I want a fast way to use assign a tha values in a DataTable to a
collection/Array/List of Classes. Each record in my DataTable should be new
Class, and tha Class would have property's for each Field in the DataTable.
Is something like this possible? Or how should I do something like this?
A more practical exemple:
I have a Class clsCustomer, which contains many orders: so a
|
by: DraguVaso |
last post by:
Hi,
I want a fast way to use assign a tha values in a DataTable to a
collection/Array/List of Classes. Each record in my DataTable should be new
Class, and tha Class would have property's for each Field in the DataTable.
Is something like this possible? Or how should I do something like this?
A more practical exemple:
I have a Class clsCustomer, which contains many orders: so a
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |