Hello.
What happens in this code, first the ID is read, the request sorts them by increment ... after which the ID is passed to the timer variable. Then another query looks for the URL field where ID is the timer variable, it reads and passes the URL to label1, and at the very end, the timer variable is incremented by 1, so that the next time the timer is accessed, itβs not the same cell but another one.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using MySql.Data.MySqlClient; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public static string host, database, user, password, strProvider; public int timer = 0; public Form1() { InitializeComponent(); host = "91.227.16.13"; password = "15*35*"; user = "h2*199_di*a"; database = "h2*199_*est"; strProvider = "Data Source=" + host + ";Database=" + database + ";User ID=" + user + ";Password=" + password; } private void Form1_Load(object sender, EventArgs e) { timer1.Enabled = true; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { MySqlConnection cnt = new MySqlConnection(strProvider); try { cnt.Open(); MySqlCommand cmd3 = cnt.CreateCommand(); MySqlCommand command = cnt.CreateCommand(); command.CommandText = "SELECT * FROM t_links ORDER BY ID DESC"; cmd3.CommandText = "SELECT * FROM t_links WHERE ID = " + timer; MySqlDataReader readID = command.ExecuteReader(); while (readID.Read()) { timer = Convert.ToInt32(readID["ID"]); } readID.Close(); MySqlDataReader readURK = cmd3.ExecuteReader(); while (readURK.Read()) { label1.Text = "URL: " + readURK["URL"].ToString(); } readURK.Close(); this.Text = timer.ToString(); timer++; } finally { cnt.Close(); } } } }
The program does not increment the variable ... and does not pass the URL to label1. Below is a screenshot of the database where I'm trying to get the values:
PS Yes, and tell me, on which hosting of images it is necessary to upload pictures so that the hashcode is not perceived as a link, but as a picture?