private void textBox2_TextChanged(object sender, TextChangedEventArgs e)
        {
            MySqlConnection conn = DBConnect.connectToDb();

            try
            {
                string q = "select * from appointment where pat_contact_no='" + pat_contact_no.Text + "';";

                MySqlCommand    MyCommand2 = new MySqlCommand(q, conn);
                MySqlDataReader MyReader2;

                MyReader2 = MyCommand2.ExecuteReader();

                while (MyReader2.Read())
                {
                    pat_name.Text    = MyReader2.GetValue(0).ToString();
                    pat_age.Text     = MyReader2.GetValue(1).ToString();
                    pat_address.Text = MyReader2.GetValue(2).ToString();
                }
                MyReader2.Close();
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message.ToString());
            }
        }
Пример #2
0
        private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
        {
            if (txtPhn.Text.Equals(""))
            {
                txtBed.Text  = "";
                txtWard.Text = "";
            }
            try
            {
                string sql = "select ward_name,bed_no from user.allocate_patient_bed where bed_status='" + "Occupied" + "' and patient_contact_no='" + txtPhn.Text + "' ;";

                MySqlCommand    MyCommand2 = new MySqlCommand(sql, conn);
                MySqlDataReader MyReader2;

                MyReader2 = MyCommand2.ExecuteReader();

                while (MyReader2.Read())
                {
                    txtWard.Text = MyReader2.GetValue(0).ToString();
                    txtBed.Text  = MyReader2.GetValue(1).ToString();
                }
                MyReader2.Close();
            }
            catch (Exception exc) { MessageBox.Show(exc.Message.ToString()); }
        }
        private void textBox2_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (textBox2.Text.Equals(""))
            {
                textBox.Text = "";
                status.Text  = "";
            }
            else
            {
                MySqlConnection conn = DBConnect.connectToDb();
                try
                {
                    string q = "select * from user.appointment where pat_contact_no='" + textBox2.Text + "';";

                    MySqlCommand    MyCommand2 = new MySqlCommand(q, conn);
                    MySqlDataReader MyReader2;

                    MyReader2 = MyCommand2.ExecuteReader();

                    while (MyReader2.Read())
                    {
                        textBox.Text = MyReader2.GetValue(0).ToString();
                        status.Text  = MyReader2.GetValue(8).ToString();
                        textBox.Focus();
                        status.Focus();
                    }
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message.ToString());
                }
            }
        }
Пример #4
0
        private List <List <string> > GetResults(string cmd)
        {
            MySqlCommand MyCommand2 = new MySqlCommand();

            MyCommand2.Connection  = _mySqlConn;
            MyCommand2.CommandText = cmd;
            MySqlDataReader MyReader2;

            MyReader2 = MyCommand2.ExecuteReader();
            List <List <string> > results = new List <List <string> >();

            while (MyReader2.Read())
            {
                List <string> lineString = new List <string>();
                for (int i = 0; i < MyReader2.FieldCount; i++)
                {
                    lineString.Add((string)MyReader2.GetValue(i));
                }
                results.Add(lineString);
            }
            return(results);
        }