Store C# class object in sql server 2005 database

  • I have a C# application, and I need to store an instance of a class object in a sql server 2005 database. For example:

    myClass oMyClass = new myClass(args);

    oMyClass.Property1 = something;

    oMyClass.Property2 = another_thing;

    At this point, I need to stick oMyClass in the database, so that I can get it out later, cast it back to myClass, and play with it some more. I tried to serialize the object to XML, but the class is not serializable, so I guess I am going to have to store it as a binary object. Does anyone have any sample code of doing this programmatically using C# and ADO.NET. Thanks.

    Thomas

Viewing post 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply