Can any one point to a code in which a dataset is
populated with a collection.

Re: populate dataset using collection by andreas

andreas
Fri Dec 19 05:33:32 CST 2003

This is a multi-part message in MIME format.

------=_NextPart_000_001A_01C3C62C.50569CA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I would imagine this is a sitution where you would have to write the
code yourself, because how the dataset should be built, depends
entierly on what you store in the collection.

A rough overview of the dataset is

DataSet
DataTables
DataRows
DataColumns

So what you would need to do it create a DataTable for your values and
then add DataColumns which corresponds to the name and datatype of
the values you want to store. Once that has been done, then you will
need to loop your collection (foreach if it supports IEnumerable) and
add a new DataRow for each item in the collection, inserting the values
into the correct columns.

I guess you could write something generic using reflection as well.

--=20
ANDREAS H=C5KANSSON
STUDENT OF SOFTWARE ENGINEERING
andreas (at) selfinflicted.org
"Jaaz" <anonymous@discussions.microsoft.com> wrote in message =
news:035e01c3c622$d88728b0$a001280a@phx.gbl...
Can any one point to a code in which a dataset is=20
populated with a collection.
------=_NextPart_000_001A_01C3C62C.50569CA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.3790.59" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I would imagine this is a sitution =
where you would=20
have to write the</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>code yourself, because how the dataset =
should be=20
built, depends</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>entierly on what you store in the=20
collection.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>A rough overview of the dataset =
is</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; DataSet</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
DataTables</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; DataRows</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DataColumns</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So what you would need to do it create =
a DataTable=20
for your values and</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>then add DataColumns which corresponds =
to the name=20
and datatype of</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>the values you want to store. Once that =
has been=20
done, then you will</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>need to loop your collection (foreach =
if it=20
supports IEnumerable) and</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>add a new DataRow for each item in the =
collection,=20
inserting the values</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>into the correct columns.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I guess you could write something =
generic using=20
reflection as well.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><BR>-- <BR>ANDREAS =
H=C5KANSSON<BR>STUDENT OF=20
SOFTWARE ENGINEERING<BR>andreas (at) selfinflicted.org</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jaaz" &lt;<A=20
=
href=3D"mailto:anonymous@discussions.microsoft.com">anonymous@discussions=
.microsoft.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:035e01c3c622$d88728b0$a001280a@phx.gbl">news:035e01c3c622$d8=
8728b0$a001280a@phx.gbl</A>...</DIV>Can=20
any one point to a code in which a dataset is <BR>populated with a=20
collection.</BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_001A_01C3C62C.50569CA0--