User (Legacy) Posted March 14, 2006 Report Share Posted March 14, 2006 Hello, Does anyone have any sample code on creating a gauge from start to finish, connecting to SQL server to get the data to populate the gauge? Regards, Irvin Link to comment Share on other sites More sharing options...
User (Legacy) Posted March 14, 2006 Author Report Share Posted March 14, 2006 Hello, Does anyone have any sample code on creating a gauge from start to finish, connecting to SQL server to get the data to populate the gauge? Regards, Irvin Link to comment Share on other sites More sharing options...
Software FX Posted March 20, 2006 Report Share Posted March 20, 2006 Hi Irvin: The following piece of code creates a radial gauge and binds the value of the main indicator to the total value of all the units in stock in the northwind database: RadialGauge radialGauge1 = new RadialGauge(); radialGauge1.MainScale.Max = 1000000; // configure the max of the main scale using (SqlConnection conn = new SqlConnection("Server=YourServerName;Database=Northwind;Trusted_Connection=yes")) { conn.Open(); using (SqlCommand command = new SqlCommand( "Select TOP 1 CAST(SUM(UnitPrice * UnitsInStock) as float) as Total from Products", conn)) { using (SqlDataReader reader = command.ExecuteReader()) { reader.Read(); radialGauge1.MainValue = (double)reader.GetValue(0); } } } However, if you use the Visual Studio designer, you won't have to write any single line of code to configure the gauge and to bind it to the dataset. -- PR "Irvin Hernandez" <ihernandez@sparinc.com> wrote in message news:a94z4U3RGHA.3992@webserver3.softwarefx.com... > Hello, > Does anyone have any sample code on creating a gauge from start to finish, > connecting to SQL server to get the data to populate the gauge? > Regards, > Irvin > > Link to comment Share on other sites More sharing options...
Software FX Posted March 20, 2006 Report Share Posted March 20, 2006 Hi Irvin: The following piece of code creates a radial gauge and binds the value of the main indicator to the total value of all the units in stock in the northwind database: RadialGauge radialGauge1 = new RadialGauge(); radialGauge1.MainScale.Max = 1000000; // configure the max of the main scale using (SqlConnection conn = new SqlConnection("Server=YourServerName;Database=Northwind;Trusted_Connection=yes")) { conn.Open(); using (SqlCommand command = new SqlCommand( "Select TOP 1 CAST(SUM(UnitPrice * UnitsInStock) as float) as Total from Products", conn)) { using (SqlDataReader reader = command.ExecuteReader()) { reader.Read(); radialGauge1.MainValue = (double)reader.GetValue(0); } } } However, if you use the Visual Studio designer, you won't have to write any single line of code to configure the gauge and to bind it to the dataset. -- PR "Irvin Hernandez" <ihernandez@sparinc.com> wrote in message news:a94z4U3RGHA.3992@webserver3.softwarefx.com... > Hello, > Does anyone have any sample code on creating a gauge from start to finish, > connecting to SQL server to get the data to populate the gauge? > Regards, > Irvin > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.