We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to save file *.edd to database

Hi everybody!
Plz help me!
How to save file *.edd to database after create it.

6 Replies

J. J.Nagarajan Syncfusion Team July 23, 2007 11:31 PM UTC

Hi Cuongnq,

Sorry for the delay in getting back to you. The diagram can be serialized in XML format using the Diagram.SaveSoap/LoadSoap methods. You can also save and load the diagram in the database. Please refer to the following code snippet

DataTable dt;
protected void Button1_Click(object sender, EventArgs e)
{
dt = new DataTable("MyTable");
dt.Columns.Add("Diagram", typeof(object));
DataRow row = dt.NewRow();
row["Diagram"] = this.DiagramWebControl1;
dt.Rows.Add(row);
dt.AcceptChanges();
}

protected void Button2_Click(object sender, EventArgs e)
{
DiagramWebControl d1 = dt.Rows[0]["Diagram"] as DiagramWebControl;
d1.SaveBinaryDocument("d1");
this.DiagramWebControl2.LoadBinaryDocument("d1");
}

Please let us know if you have any questions.

Thanks,
Nagaraj


CU cuongnq July 26, 2007 03:02 AM UTC

Nice code, Thanks


BA Balaji October 15, 2007 10:46 AM UTC

Hi,
You have showed how to store in a memory table.i want to know how to store this into a database table and datatype i need to choose to store the diagram to a database table.
i created a table with a varbinary(max) column type. but i am getting an data type mismatch error when i am trying to save the diagram object to the varbinary column.

Thanks
Balaji


MS Mohamed Suhaib Fahad A. Syncfusion Team October 18, 2007 06:51 AM UTC

Hi Balaji,

Thanks for evaluating Syncfusion products.

We have used SQL server 2005 express edition to create the sample for you.

Here are the details about your query,

Saving diagram into Database
-------------------------------------------------

You can save the node objects into database. Please follow the steps below for this.
1) First save the diagram in EDD format.
1) Convert diagram(EDD) into bytes using Stream.
2) Insert bytes into table column.

You can use varbinary(max) datatype for inserting diagram since diagram file size will be large to access.

Similarly you can load the diagram from database by reading it from Stream.

Please refer the working sample and let us know if you still face any issues.

http://websamples.syncfusion.com/samples/Diagram.Windows/P38280/main.htm

Also please let us know if you have any other queries.

You can follow up any other queries in DirectTrac itself (in which you had created an incident earlier).

Regards,
Fahad


KK Karl Kemp July 3, 2008 02:31 PM UTC

Just a note to future searchers, I'm pretty sure the code attached to this sample doe NOT do what the author thinks it does.

The code saves and loads a diagram from a file on disk, then reads diagram data from a database but does nothing with it.

It DOES NOT appear to load the diagram data directly from the database, as is claimed.



J. J.Nagarajan Syncfusion Team July 7, 2008 10:35 AM UTC

Hi ,

Sorry for the inconvenience caused. You can get the byte array of saved edd file using SqlDataReader.GetValue(0) method. Then you can convert that byte array to MemoryStream and load the diagram file.

Please refer to the modified sample that demonstrates this completely.

http://websamples.syncfusion.com/samples/Diagram.Windows/F64301/main.htm

Please refer to it and let me know if this helps.

Regards,
Nagaraj


Loader.
Live Chat Icon For mobile
Up arrow icon