private void obtenerFolio()
        {
            ConexionMySQL conexion = new ConexionMySQL();

            try
            {
                string           Query   = "SELECT MAX(idPaciente) FROM paciente;";
                MySqlDataAdapter adapter = conexion.conexionGetData(Query);
                DataTable        datos   = new DataTable();
                adapter.Fill(datos);

                textBox1.Text = Convert.ToString((Convert.ToInt32(datos.Rows[0][0].ToString()) + 1));
                conexion.conexionClose();
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        private void obtenerFolio()
        {
            ConexionMySQL conexion = new ConexionMySQL();

            try
            {
                string           Query   = "SELECT idPaciente,nombrePaciente,apePaternoPaciente,apeMaternoPaciente FROM paciente WHERE idPaciente=" + textBox1.Text + ";";
                MySqlDataAdapter adapter = conexion.conexionGetData(Query);
                DataTable        datos   = new DataTable();
                adapter.Fill(datos);
                conexion.conexionClose();

                //textBox1.Text = Convert.ToString(datos.Rows[0][0].ToString());
                textBox2.Text = Convert.ToString(datos.Rows[0][1].ToString());
                textBox3.Text = Convert.ToString(datos.Rows[0][2].ToString());
                textBox4.Text = Convert.ToString(datos.Rows[0][3].ToString());

                textBox5.Text = "";
                textBox6.Text = "";
                textBox7.Text = "";
                textBox8.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se pudo obtener la informacion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                button3.Enabled   = false;
                textBox1.ReadOnly = true;

                button1.Enabled  = true;
                button2.Enabled  = true;
                textBox5.Enabled = true;
                textBox6.Enabled = true;
                textBox7.Enabled = true;
                textBox8.Enabled = true;
            }
        }