Home All Groups Group Topic Archive Search About

Newbie: Can I save objects in a DataTable?

Author
20 Feb 2006 9:49 PM
deko
Can I save Array objects in a DataTable?  If I can, I assume the Framework
has methods to serialize this out to XML.  What I am trying to do is create
an in-memory database when a form opens, and persist it out to XML when the
form closes.  The joker in the pack is that I need to save objects in the
table and not just primitive data types.  Is this possible?

Author
20 Feb 2006 10:06 PM
deko
> Can I save Array objects in a DataTable?  If I can, I assume the Framework
> has methods to serialize this out to XML.  What I am trying to do is
> create an in-memory database when a form opens, and persist it out to XML
> when the form closes.  The joker in the pack is that I need to save
> objects in the table and not just primitive data types.  Is this possible?

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

The answer is no.

Then ADO.NET DataColumn.DataType property supports only the base .NET
Framework data types.

whaddya think this?  Oracle?
Author
20 Feb 2006 10:08 PM
vinu
Hi,

Using DataSet you can achive this. DataSet can be used as a in memory data
base . To learn more about data set see the following site

http://samples.gotdotnet.com/quickstart/winforms/doc/DataAccessPlaceHolder.aspx
http://www.devarticles.com/c/a/ADO.NET/Datasets-in-Microsoft.Net/

vinu

Show quote
"deko" <deko@nospam.com> wrote in message
news:3-udnXdZ6O-mpGfenZ2dnUVZ_sOdnZ2d@comcast.com...
> Can I save Array objects in a DataTable?  If I can, I assume the Framework
> has methods to serialize this out to XML.  What I am trying to do is
> create an in-memory database when a form opens, and persist it out to XML
> when the form closes.  The joker in the pack is that I need to save
> objects in the table and not just primitive data types.  Is this possible?
Author
20 Feb 2006 11:20 PM
William (Bill) Vaughn
SS2K5 can store XML in a column but I don't know of many that would
recommend this approach. You can also construct a User-defined type of your
own but again, this should be used with caution.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"deko" <deko@nospam.com> wrote in message
news:3-udnXdZ6O-mpGfenZ2dnUVZ_sOdnZ2d@comcast.com...
> Can I save Array objects in a DataTable?  If I can, I assume the Framework
> has methods to serialize this out to XML.  What I am trying to do is
> create an in-memory database when a form opens, and persist it out to XML
> when the form closes.  The joker in the pack is that I need to save
> objects in the table and not just primitive data types.  Is this possible?
Author
21 Feb 2006 6:18 AM
Cor Ligthert [MVP]
Deko,

At least you can normaly serialize by instance an arraylist.
That you can save in a datatable. It is quiet easy. See this sample.

Be aware that in this way is not an easy way of working with a database
(only your program can use it, not somebody who is not using your program,
beside those who know the method of course and can do that.)

http://www.windowsformsdatagridhelp.com/default.aspx?ID=7ffd296f-9e81-47e6-88dc-61641f5c8d9d

I hope this helps,

Cor

AddThis Social Bookmark Button