Jump to content
Software FX Community
Sign in to follow this  
User (Legacy)

Sample Code

Recommended Posts

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

>

>

Share this post


Link to post
Share on other sites

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

>

>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...