Ejemplo n.º 1
0
        private void Dismiss_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = imageList1.Images[0];
            timer1.Enabled    = true;
            label4.Enabled    = false;
            timer1.Interval   = 1000;
            label4.Text       = DateTime.Now.ToLocalTime().ToString();
            try
            {
                mysql           Mysql = new mysql();
                MySqlConnection conn  = Mysql.Connection();
                string          sql   = @"select * from staff";
                MySqlDataReader dr    = Mysql.GetRead(sql);

                while (dr.Read())
                {
                    comboBox1.Items.Add(dr["name"].ToString());
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally { }
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         mysql           Mysql = new mysql();
         MySqlConnection conn  = Mysql.Connection();
         string          sql   = @"select * from staff";
         DataSet         ds    = Mysql.GetDataSet(sql);
         dataGridView1.DataSource = ds.Tables[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("异常为:" + ex.Message);
     }
     finally
     {
     }
 }
Ejemplo n.º 3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string Name = comboBox1.SelectedItem.ToString();

            try
            {
                mysql           Mysql = new mysql();
                MySqlConnection conn  = Mysql.Connection();
                string          sql   = @"select * from staff where name='" + Name + "'";
                DataSet         ds    = Mysql.GetDataSet(sql);
                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常为:" + ex.Message);
            }
            finally
            {
            }
        }