private void gunaLabel2_Click(object sender, EventArgs e) { OleDbCommand command = new OleDbCommand($"SELECT * FROM Announcement WHERE uUsername = '******'", connection); connection.Open(); OleDbDataReader reader = command.ExecuteReader(); AdminPanel.Instance.table.Controls.Clear(); while (reader.Read()) { ElProperty Item = new ElProperty(); byte[] Photo = (byte[])(reader[16]); MemoryStream memoryStream = new MemoryStream(Photo); Item.gunaPictureBox2.Image = Image.FromStream(memoryStream); Item.gunaLabel1.Text = $"{reader[5]}к {reader[10]} / {reader[11]} м"; Item.gunaLabel2.Text = $"{reader[4]} / {reader[3]}"; Item.gunaLabel3.Text = reader[2].ToString(); Item.IDLabel.Text = reader[0].ToString(); AdminPanel.Instance.table.Controls.Add(Item); } reader.Close(); connection.Close(); }
public void PrintAnnouncement(string inquiry) { OleDbCommand command = new OleDbCommand(inquiry, connection); connection.Open(); OleDbDataReader reader = command.ExecuteReader(); tableLayoutPanel1.Controls.Clear(); while (reader.Read()) { ElProperty Item = new ElProperty(); byte[] Photo = (byte[])(reader[16]); MemoryStream memoryStream = new MemoryStream(Photo); Item.gunaPictureBox2.Image = Image.FromStream(memoryStream); Item.gunaLabel1.Text = $"{reader[5]}к {reader[10]} / {reader[11]} м"; Item.gunaLabel2.Text = $"{reader[4]} / {reader[3]}"; Item.gunaLabel3.Text = reader[2].ToString(); Item.IDLabel.Text = reader[0].ToString(); tableLayoutPanel1.Controls.Add(Item); } reader.Close(); connection.Close(); }