Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8094163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:42:36+00:00 2026-06-05T20:42:36+00:00

I have the following stored procedure that I have to get data from: EXECUTE

  • 0

I have the following stored procedure that I have to get data from:

   EXECUTE [dbo].[StationHealthStatusSummary2]
            @LineId varchar(100),        // 5,9,10
            @MeasurementDt datetime,    //2012/06/06
            @Ntotal Int output,
            @N0 int output,
            @N1 int output,
            @N2 int output,
            @N3 int output,
            @N4 int output,
            @N5 int output,
            @N6 int output,
            @N7 int output,
            @N8 int output,
            @N9 int output,
            @N10 int output,
            @N11 int output,
            @N12 int output,
            @N13 int output,
            @N14 int output,
            @N15 int output,
            @N16 int output
       GO

Now I can send parameters to LineID and Measurement date as follows:

SqlConnection sql = new SqlConnection(@"Data Source=(local)\SQLEXPRESS;Initial Catalog=iComs;Persist Security Info=True;User ID=sa;Password=Password);

SqlCommand getData = new SqlCommand("StationHealthStatusSummary2", sql);

SqlDataAdapter da = new SqlDataAdapter(getData);

getData.CommandType = CommandType.StoredProcedure;
getData.Parameters.Add(new SqlParameter("@LineId", Lines));
getData.Parameters.Add(new SqlParameter("@MeasurementDt", date1));

SqlParameter ParamaterNtotal = new SqlParameter();
ParamaterNtotal.ParameterName = "@Ntotal";
ParamaterNtotal.SqlDbType = SqlDbType.Int;
ParamaterNtotal.Direction = ParameterDirection.Output;
getData.Parameters.Add(ParamaterNtotal);

sql.Open();

getData.ExecuteNonQuery(); 

Now I can get the value of NTotal and assign it to a Teechart (PieSlice),
but how do I get the value for @N0..@N16?

I’ve got some code that might give you some idea of what I’m trying to accomplish.

int NTotal = int.Parse(getData.Parameters["@Ntotal"].Value.ToString());

if (GetVariantVariableI(getData.Parameters[0].Value) = 0)
{               
    for (c = 1; c <= 18; c++)
    { 
        Nvl = GetVariantVariableI(getData.Parameters[2+c].Value);

        switch(c)
        {
            case 1:
                NTotal = Nvl;
                break;

            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:                           
            case 12:                            
            case 13:                           
            case 14:                           
            case 15:                            
            case 16:                           
            case 17:
            case 18:
            case 19:
            case 20:
                cstatus = c-2;
                NPieValues[cstatus] = Nvl;
                break;
   }   

   string SliceName;
   int NUsed;

   NUsed = 0;

   for(i=0;i<=16;i++)
   {
      NUsed = NUsed + NPieValues[i];
   }

   if (NUsed < NTotal)
   {
       Chart1.Series[0].Add(NTotal - NUsed);
       slice1.Title = "Not Connected";
       slice1.Add();
       slice1.Color = System.Drawing.Color.Silver;
   }

   if (NUsed > NTotal)
   {
      NPieValues[7] = NPieValues[7]-(NUsed-NTotal);
   }

   for (i=0;i<=16;i++)
   {
     if (NPieValues[i]>0)
     {
         switch(i)
         {
            case 0: SliceName ="Green"; 
                    break;
            case 1: SliceName ="Yellow";
                    break;
            case 2: SliceName ="Orange";
                    break;
            case 3: SliceName ="Red";
                    break;
            case 4: SliceName ="Broken Rail";
                    break;
            case 5: SliceName ="Buckling Rail";
                    break;
            case 6: SliceName ="Maintenance required";
                    break;
            case 7: SliceName ="Station(s) Off";
                    break;
            case 8: SliceName ="Rail Differential kN";
                    break;
            case 9: SliceName ="Left Rail Sensor Faulty";
                    break;
            case 10: SliceName ="Right Rail Sensor Faulty";
                     break;
            case 11: SliceName ="Temperature Rail Sensor Faulty";
                     break;
            case 12: SliceName ="Calibration Required";
                     break;
            case 13: SliceName ="Station Vandalised";
                     break;
            case 14: SliceName ="Station uninstalled";
                     break;
            case 15: SliceName ="Gauges removed for Maintenance";
                     break;
            case 16: SliceName ="No GSM Coverage";
                     break;
            default:
                     SliceName ="?";
         }
         switch(i)
         {
          case 0: clr = "System.Drawing.Color.Green";
                 break;
          case 1:clr = "System.Drawing.Color.Yellow";
                 break;
          case 2:clr = "System.Drawing.Color.Orrange";
                 break;
          case 3:clr = "System.Drawing.Color.Red";
                 break;
          case 4:
          case 5:
          case 8:clr = "System.Drawing.Color.Purple";
                 break;
          case 6:clr = "System.Drawing.Color.Black";
                 break;
          case 7:clr = "System.Drawing.Color.Gray";
                 break;;
          case 9:clr = "System.Drawing.ColorTranslator.FromHtml('#E0671F')";
                 break;
          case 10:clr = "System.Drawing.ColorTranslator.FromHtml('#BA4EC2')";
                 break;
          case  11:clr = "System.Drawing.ColorTranslator.FromHtml('#FF8000')";
                 break;
          case  12:clr =  "System.Drawing.ColorTranslator.FromHtml('#BF4093')";
                 break;
          case  13:clr = "System.Drawing.Color.SkyBlue";
                 break;
          case 14:clr = "System.Drawing.Color.Aqua";
                 break;
          case 15:clr = "System.Drawing.ColorTranslator.FromHtml('#BFBFFF')";
                 break;                 
          case 16:clr = "System.Drawing.Color.MedGray";
                 break;
             default : clr = "System.Drawing.Color.White";
                 break;              
         }
      slice1.Add(NPieValues[i],SliceName,clr);
     }

 }
            }
        }

    }

Now after it got all those values it has to populate the piechart.

Please, any help will be highly appreciated and please tell me if I’m being too vague.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:42:39+00:00Added an answer on June 5, 2026 at 8:42 pm

    You have added @Ntotal as an Output parameter, why didn’t you add all the others?

    SqlParameter n = new SqlParameter();
    n.ParameterName = "@N0";
    n.SqlDbType = SqlDbType.Int;
    n.Direction = ParameterDirection.Output;
    getData.Parameters.Add(n); 
    

    Then you can retrieve the output values the same way you do with @Ntotal. Also, you can retrieve the values by name instead of looping through them, if you prefer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a stored procedure that does the following (modified out the data
I have a stored procedure that goes like this: ALTER PROCEDURE [dbo].[AuthenticateUser] @AzUserName varchar(20),
I have the following iBatis mapping for an Oracle Stored Procedure that returns a
I have the fallowing stored procedure: CREATE PROCEDURE `get`(IN tb VARCHAR(50), IN id INTEGER)
I want to do following: Make Oracle stored procedure for read all data from
I have a stored procedure that retrieves sensitive information from an SQL Server 2008
I have the following stored procedure that I am trying to convert to a
I have following table Managers (simplified): ID, int Name, nvarchar(100) In a stored procedure
I have the following stored procedure which will generate mon to sun and then
I am using Oracle 10g and I have the following stored procedure: CREATE OR

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.