Save c# objects in sql server 2008

  • Thread starter Thread starter alex
  • Start date Start date
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..
 
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.
 
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
 
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.
 
Back
Top