Home All Groups Group Topic Archive Search About

create datatable from array of objects?

Author
1 Nov 2005 4:34 PM
hazz
How can I do that?
Thank you.
-hazz

Author
1 Nov 2005 4:42 PM
Miha Markic [MVP C#]
You have to crete the table manually (perhaps by inspecing first row's
column types), but you can import data easily using DataTable.Rows.Add and
passing object array for a row at a time.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Show quote
"hazz" <greghazz***@comcast.net> wrote in message
news:%23nOGoIw3FHA.472@TK2MSFTNGP15.phx.gbl...
> How can I do that?
> Thank you.
> -hazz
>
Author
1 Nov 2005 4:50 PM
hazz
Thank you Miha! I could see the DataTable.Rows.Add requirement. I will
figure out now to create the table manually.  -hazz

Show quote
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%23uY05Mw3FHA.2196@tk2msftngp13.phx.gbl...
> You have to crete the table manually (perhaps by inspecing first row's
> column types), but you can import data easily using DataTable.Rows.Add and
> passing object array for a row at a time.
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "hazz" <greghazz***@comcast.net> wrote in message
> news:%23nOGoIw3FHA.472@TK2MSFTNGP15.phx.gbl...
>> How can I do that?
>> Thank you.
>> -hazz
>>
>
>
Author
1 Nov 2005 5:46 PM
Cor Ligthert [MVP]
Hazz,


The datatable.loaddatarow, makes from an array of values a datarow.
Be aware that the array of values in every seperate object has to fullfill
the rules about the columns.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclassloaddatarowtopic.asp

I hope this helps,

Cor
Author
1 Nov 2005 11:44 PM
hazz
Thank you Cor. The link was very helpful.
And I will pay close attention to my array/column value correspondence.
thanks again.
- Hazz

Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:uyW3ixw3FHA.1416@TK2MSFTNGP09.phx.gbl...
> Hazz,
>
>
> The datatable.loaddatarow, makes from an array of values a datarow.
> Be aware that the array of values in every seperate object has to fullfill
> the rules about the columns.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclassloaddatarowtopic.asp
>
> I hope this helps,
>
> Cor
>

AddThis Social Bookmark Button