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.
Unfortunately, activation email could not send to your email. Please try again.

Diagram from Sample

Thread ID:

Created:

Updated:

Platform:

Replies:

65732 Jul 27,2007 04:07 AM Jul 27,2007 05:00 PM ASP.NET Web Forms (Classic) 3
loading
Tags: DiagramWebControl
Nico
Asked On July 27, 2007 04:07 AM

Hello,

How to generate à diagram from a database ?

thanks a lot

cuongnq
Replied On July 27, 2007 06:06 AM

Very Easy,
View The OrgLayout sample shows an application that uses a DiagramWebControl to display an organizational chart using employees data sourced from:

1. An Access database
2. An XML format datafile

In: diagram.web\Samples\2.0\OrgLayout

Nico
Replied On July 27, 2007 11:14 AM

In 5 version i can't find those files...

J.Nagarajan [Syncfusion]
Replied On July 27, 2007 05:00 PM

Hi Nico,

If you want to load the diagram from the data base then please refer to the following code snippet

// Connection string for the Org.mdb Access database
string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + datasrc + ";";
OleDbConnection orgdbconnection = new OleDbConnection(connectionstring);

orgdbconnection.Open();
// Query to select all records from the Org.mbd database
string orgdbselectquery = "SELECT EmployeeID, Name, ManagerID FROM Employees";
OleDbCommand orgdbcommand = new OleDbCommand(orgdbselectquery, orgdbconnection);
// Create a connection to the datasource

// Execute the query command to build the data reader
OleDbDataReader orgdbreader = orgdbcommand.ExecuteReader();

// Extract employee data from the reader
while (orgdbreader.Read())
{
object[] employeedata = new object[3];
int count = orgdbreader.GetValues(employeedata);

// Create an Employee instance to represent each employee
Employee emply = new Employee();
emply.EmployeeID = employeedata[0].ToString();
emply.EmployeeName = (string)employeedata[1];
if (count == 3)
emply.ManagerID = employeedata[2].ToString();

htemployees.Add(emply.EmployeeID, emply);
}
// Close the reader
orgdbreader.Close();
// Close the connection
orgdbcommand.Connection.Close();

Please refer to our OrgLayout sample(My Documents\Syncfusion\EssentialStudio\5.1.0.51\Web\diagram.web\Samples\2.0\OrgLayout) for more details. You can see the data base file in "App_Data" folder of this application. I have attached the sample for your reference.

OrgChartSample.zip

Please refer to it and let me know if you have any questions.

Thanks,
Nagaraj

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;