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

  • Home
  • SEARCH
  • 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 7049969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:05:10+00:00 2026-05-28T03:05:10+00:00

I really need some help regarding to my coding. In my coding, I need

  • 0

I really need some help regarding to my coding. In my coding, I need to use static variables to pass value between functions and I really don’t how to do it. Really appreciate if someone can assist me about this. Thanks.

static String TypeOfReport;
static DateTime DateOfExecution;

static DateTime StartDate;
static DateTime EndDate;
static int SpokeCode;

static void Main(string[] args)
{
    DateTime start = System.DateTime.Now.AddMinutes(1);
    Schedule.PeriodicSchedules schedule = new Schedule.PeriodicSchedules(start, Schedule.PeriodicSchedules.Frequency.Minutely);
    schedule.Elapsed += new System.Timers.ElapsedEventHandler(GenerateReport);
    schedule.Enabled = true;

    Console.ReadLine();
}

static void GenerateReport(object sender, EventArgs e)
{
    if (TypeOfReport == "BillingReport")
    {
        Schedule.PeriodicSchedules s = new Schedule.PeriodicSchedules(DateOfExecution, Schedule.PeriodicSchedules.Frequency.Minutely);
        s.Elapsed += new System.Timers.ElapsedEventHandler(hell);

        crRpt.Load("C:\\rptBilling.rpt");
        ReportLogin(crRpt);

        crRpt.SetParameterValue("@CollectionStartDate", StartDate);
        crRpt.SetParameterValue("@CollectionEndDate", EndDate);
        crRpt.SetParameterValue("@SpokeCode", SpokeCode);
    }                
}            

static void ReportAccess()
{
    SqlConnection thisConnection = new SqlConnection("data source=s3rosteam;initial catalog=ReportDB; integrated security=True; Pooling=False;");
    SqlCommand thisCommand = null;

    try
    {
        String strSQL = "SELECT TypeO fReport,DateOfExecution,StartDate,EndDate,SpokeCode FROM dbo.Schedule WHERE TypeOfReport ='" + TypeOfReport + "', DateOfExecution = '" + DateOfExecution + "'";
        thisConnection.Open();
        thisCommand = new SqlCommand(strSQL);
        thisCommand.Connection = thisConnection;
        thisCommand.CommandType = CommandType.Text;

        using (SqlDataReader reader = thisCommand.ExecuteReader())
        {
            reader.Read();
            StartDate = Convert.ToDateTime(reader["StartDate"]);
            EndDate = Convert.ToDateTime(reader["EndDate"]);
            SpokeCode = Convert.ToInt16(reader["SpokeCode"]);  
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
    }

    finally
    {
        thisCommand.Dispose();
        thisConnection.Close();
        thisCommand.Dispose();
    }
}
  • 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-05-28T03:05:11+00:00Added an answer on May 28, 2026 at 3:05 am

    Thanks for the suggestions. I managed to pass the value. But I’m not using static variable.

    static void GenerateReport()
    {  
        string[] arrTypes = ReadReport().Split('~');
    
        foreach (string strReportType in arrTypes)
        {
            if (strReportType == "BillingReport")
            {
                while (ThisReader.Read())
                {
                    crRpt.SetParameterValue("@CollectionStartDate", ThisReader["StartDate"]);
                    crRpt.SetParameterValue("@CollectionEndDate", ThisReader["EndDate"]);
                    crRpt.SetParameterValue("@SpokeCode", ThisReader["SpokeCode"]);
                }
            }           
        }
    }
    
    static string ReadReport()
    {
        try
        {
            ………     
            using (SqlDataReader reader = thisCommand.ExecuteReader())
            {
                while (reader.Read())
                {
                    strReturn += reader["TypeOfReport"].ToString() + "~";
                }
                reader.Close();
            }
            strReturn = strReturn.Remove(strReturn.Length - 1);                
    
        }
        catch (Exception ex)
        {  }
    
        finally
        {  }
        return strReturn;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really need some help here, we are trying to use our player over
I really need some help in Regular Expressions, i'm working on a function like
I really need some help with this as I have been trying to fix
I need some help in figuring a compiler error which is really driving me
I've some questions .. and I really need your help. I have an application.
I'm confused about how DQL works, and really need some help here. I have
I really need some help with forming a MySQL query that I just cannot
I really need some help with the OSMdroid library. It is useful to have
I really need some quick tips here. I've got this VBScript script which sends
I have decided that I really need to get some flowcharts for reverse engineering

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.