Practical Tips: How To Connect MindFusion.Charting's Database Properties to a Database in VisualStudio 2005?
Create a database connection
- Right-click the Servers pane and choose Add Connection.
- Choose the data source and database names, test the connection and press OK.
Create a DataAdapter
- In design view, choose the appropriate data adapter control from the toolbox - OleDbDataAdapter, OdbcDataAdapter, and so on. You can add more database controls if you right-click the Toolbox pane and select Choose Items.
- Follow the steps of the DataAdapter wizard to choose the appropriate database tables and columns that you'll need.
Create a DataSet
- Right-click at the icon of the DataAdapter you have created in the previous steps.
- Choose Generate DataSet.
Bind MindFusion.Charting properties
- In design view, in the 'Data' properties group in the Properties' browser for MindFusion.Charting, first set DataSource to your DataSet object from the drop-down list.
- Set DataMember to the desired database table from the drop-down list.
- Search for the chart properties (ending with 'field(s)') and bind them to the respective columns from the drop-down list.
Read the data at run time
Add the following lines of code in your application, a good place is behind InitalizeComponent():
C#
Copy Code
|
---|
myDataAdapter.Fill(myDataSet); myChart.DataBind(); myChart.UpdateChart(); |
See Also
Using VisualStudio 2008