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 6640305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:39:25+00:00 2026-05-25T23:39:25+00:00

I have a list and i want to use this list value to create

  • 0

I have a list and i want to use this list value to create timer.And also want to use those timer to execute 2 MySql query. Here is my code,

    Timer timer;        
    List<uint> _dataValues = new List<uint>();     

    private void button1_Click(object sender, EventArgs e)
    {
        string myconstring = "SERVER=localhost;" + "DATABASE=alicosms;" + "UID=root;" + "PASSWORD=;";
        MySqlConnection mycon = new MySqlConnection(myconstring);
        string sql = "SELECT flag FROM sms_data_bankasia group by flag";
        MySqlCommand comd = mycon.CreateCommand();
        comd.CommandText = sql;
        mycon.Open();
        MySqlDataReader dtr = comd.ExecuteReader();
        count = 0;          
        while (dtr.Read())
            {                   
                _dataValues.Add(dtr.GetUInt32(0));

            }

        dtr.Close();                                  


    }
    void PrepareTimers(List<uint> dataValues)
    {
        foreach (uint dataValue in _dataValues)
        {
           timer = new Timer(TimerAction, dataValue, 1000, 0);
        }
    }
    void TimerAction(object flag)
    {
        string myconstring = "SERVER=localhost;" + "DATABASE=alicosms;" + "UID=root;" + "PASSWORD=;";
        MySqlConnection mycon = new MySqlConnection(myconstring);
        MySqlCommand cmd = new MySqlCommand("SELECT * FROM sms_data_bankasia WHERE flag = @flag", mycon);
        MySqlParameter param = new MySqlParameter();
        param.ParameterName = "@flag";
        param.Value = flag;
        cmd.Parameters.Add(param);


    }    

In PrepareTimers section provide error.I also want to add another query in “TimerAction”.So what to do ?Any one can help me?I am using VS 2005.net and C# language.

  • 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-25T23:39:26+00:00Added an answer on May 25, 2026 at 11:39 pm

    Since your error syas that No overload for method 'Timer' takes '4' arguments, I’m guessing that you are using System.Timers.Timer class, for which there is no constructor which takes 4 arguments.

    As per your code, you need to use:

    System.Threading.Timer
    

    Edit(as per the comment): In order to overcome from this naming conflict, either you can create an alias for the nemespace like

    using ThreadingTimer = System.Threading.Timer;
    

    and use ThreadingTimer or use fully qualified name like:

    System.Threading.Timer = new System.Threading.Timer(TimerAction, dataValue, 1000, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We Have this : List<Person> listPerson ; Want to use the Data of listPerson
Using bash, I have a list of strings that I want to use to
I have a comma delimited list of ids that I want to use to
I have a list with nested lists and I want to create a function
I have List I want to sort Desc by Priority, which is int and
I have a list that I want to loop through (for trimtemp in trim)
I have one list that I want to take a slice of, reverse that
I have 2 list and i want to add a class =last to the
I have a list and I want to extract to another list the data
I have a list that I want to put in a dictionary, for simplicity

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.