ID per timer



  • Hey, everybody, I got a problem. I've finally been able to make a website transition mechanism, but now there's a problem how a function can be called, for example, every 10 seconds. I've been in a timer, there's no effect. This is the code I was trying to put in the timer:

        private void timer2_Tick(object sender, EventArgs e)
        {
            timer++;
    
        MySqlConnection cnt = new MySqlConnection(strProvider);
        try
        {
            cnt.Open();
            MySqlCommand cmd3 = cnt.CreateCommand();
    
            cmd3.CommandText = "SELECT * FROM t_links WHERE ID = '" + timer + "'";
            MySqlDataReader readURL = cmd3.ExecuteReader();
            while (readURL.Read())
            {
                URL = readURL["URL"].ToString();
                webBrowser1.Navigate(URL);
                labelUrl.Text = "URL: " + URL;
            }
            readURL.Close();
        }
        finally     
        {
            cnt.Close();
        }
    }
    



  • WHERE ID = '" + timer + "'";
    

    Try that.

    WHERE ID = " + timer;
    




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2