예제 #1
0
파일: Form1.cs 프로젝트: 5ore/MurphyPub
        public void PopuniPRightPanel()
        {
            MySqlConnection con = new MySqlConnection(constr);

            cmdstr = "SELECT * From Promocije WHERE ID = " + UpdateID.ToString();
            MySqlCommand    cmd    = new MySqlCommand(cmdstr, con);
            MySqlDataReader reader = null;

            try
            {
                con.Open();
                reader = cmd.ExecuteReader();
                reader.Read();

                PtbNaziv.Text = reader[1].ToString();
                Pnum.Value    = (decimal)reader[2];
                if (reader[3].ToString().Equals("Priv"))
                {
                    rbPriv.Checked = true;
                    rbFix.Checked  = false;
                }
                else
                {
                    rbPriv.Checked = false;
                    rbFix.Checked  = true;
                }
                Pdatetime.Value = (DateTime)reader[4];
                PtbOpis.Text    = reader[5].ToString();
                Byte[] ImageByte = (Byte[])(reader[6]);
                if (ImageByte != null)
                {
                    Ppicture.Image = ByteToImage(ImageByte);
                    Ppicture.Refresh();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                reader.Close();
                con.Close();
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: 5ore/MurphyPub
 private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
 {
     ImageChanged   = true;
     Ppicture.Image = Image.FromFile(openFileDialog1.FileName);
     Ppicture.Refresh();
 }