Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LoadFrom(Stream) (Read 2678 times)
Dom@Hadley
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 5th, 2017
LoadFrom(Stream)
Oct 11th, 2017 at 8:45am
Print Post  
Hi
I'm saving the calendar to a memorystream and then saving the stream to array of bytes to put into the database in a varbinary(max) field. The save works great and I can see from the database (when cast as xml in sql management studio) that the xml causes no error.

Although when I try to load, first loading the entity framework field which is varbinary(max) as a byte[] array and then using a memorystream to pass this to the calendar.LoadFrom(Stream) method. I get an exception "Root Element is missing". This is not something that I can get at as it's in the calendar code itself. When I don't use the memorystream but instead use a file, it loads and saves ok.

I want to save the xml directly to the database and not to file as a file is not practical in our circumstances. Please can you help?
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3187
Joined: Oct 19th, 2005
Re: LoadFrom(Stream)
Reply #1 - Oct 11th, 2017 at 8:55am
Print Post  
Hi,

Does it show same exception if you immediately reload from the byte array without going through database?

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Dom@Hadley
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 5th, 2017
Re: LoadFrom(Stream)
Reply #2 - Oct 11th, 2017 at 12:47pm
Print Post  
It did and then I realised that there were fields with null values.  It was my mistake.
Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint