Save c# objects in sql server 2008

A

alex

Hello,

I am working on a project where I am generating some winforms
usercontrols thanks to a designer hosted in my application. I would
like to store these usercontrols in sqlserver 2008.

In an other application on an other computer linked to the same
database (sql server), I would like to retrieve and load the
usercontrols.

Is it possible to store a usercontrol instance in sqlserver?

I can get the assembly. Is it possible to store the assembly?

Do you have an other suggestions?

Thank you for your answers..
 
M

manas

One way to do that is to Serialize the object, in your example the
user control.
If your user control is Serializable then you can store the state of
the control in file or in DB.

[Serializable]
public class SerializableClass : ISerializable
{
//your logic here
}

This class (user control) and its state can be saved in DB after
serialization.
Try that.
 
A

alex

One way to do that is to Serialize the object, in your example the
user control.
If your user control is Serializable then you can store the state of
the control in file or in DB.

[Serializable]
    public class SerializableClass : ISerializable
    {
        //your logic here
    }

This class (user control) and its state can be saved in DB after
serialization.
Try that.

You think I serialize the control with the binary serializer? And
after I save the binary in the DB?

Is it right? Will you have an example to show me?

Thank you
 
J

Jeff Johnson

One way to do that is to Serialize the object, in your example the
user control.
If your user control is Serializable then you can store the state of
the control in file or in DB.

[Serializable]
public class SerializableClass : ISerializable
{
//your logic here
}

This class (user control) and its state can be saved in DB after
serialization.
Try that.
You think I serialize the control with the binary serializer? And
after I save the binary in the DB?
Is it right? Will you have an example to show me?

There are a gazillion examples of serialization out there. Do a search. And
for SQL Server, just store the results in a varbinary(max) column.
 

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