How to store objects created with C# in database in .NET Framework

G

Guest

I want to store the objects that i create in run time in database. In a way
that, for a product a create an object from a class written with C#, define
its properties and functions that it has, and want to store it in a database
(SQL Server 2K). I want the columns to be created and filled dynamically when
an object is inserted in db (Just like in J2EE, which is called i think
relational mapping, or something like this).

How can I do that?
 
M

Mahesh Devjibhai Dhola [MVP]

May this helps you,
- Serialize your object at run-time using binary formatter into byte stream
- Store the binary data into sql server database as BLOB like how you store
images etc as binary data
- On extraction, get the binary data stream as byte[] and deseializer it to
get actual object

Or You may want to use the way given in the following link,
http://www.codeproject.com/cs/database/persistedobject.asp

HTH,
 

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

Top