コード例 #1
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            selectPatient c = new selectPatient();

            c.Show();
            this.Hide();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string time = DateTime.Now.ToString("HH:mm:ss:tt");

            // adding check in data in table
            try
            { //you need to add your server name to connect on your computer
                String        conString = "server=DESKTOP-C7FFPE6\\MSSQLSERVER01; database=patientMoniter; Integrated Security=SSPI;";
                String        Query     = "UPDATE checkingUser set checking = 'in', time ='" + time + "' WHERE userName='******'";
                SqlConnection connect   = new SqlConnection(conString);
                SqlCommand    command   = new SqlCommand(Query, connect);
                SqlDataReader reader;

                connect.Open();
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                }
                connect.Close();
                MessageBox.Show("you have checked in");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            selectPatient sp = new selectPatient();

            sp.Show();
            this.Hide();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            // now connect to database and fill the dropdown from the database table

            try
            { //you need to add your server name to connect on your computer
                String conString = "server=DESKTOP-C7FFPE6\\MSSQLSERVER01; database=patientMoniter; Integrated Security=SSPI;";

                //getting all the values from the editPatientReading
                string min            = minValue.Text;
                string max            = maxValue.Text;
                double minVal         = System.Convert.ToDouble(min);
                double maxVal         = System.Convert.ToDouble(max);
                string selectedModule = this.moduleComboBox.GetItemText(this.moduleComboBox.SelectedItem);

                //update query to update min and max value
                String        Query   = "UPDATE patients SET min = " + minVal + ", max = " + maxVal + "WHERE patientName='" + patientName + "' and module='" + selectedModule + "'";;
                SqlConnection connect = new SqlConnection(conString);
                SqlCommand    command = new SqlCommand(Query, connect);
                connect.Open();
                int n = command.ExecuteNonQuery();
                if (n >= 0)
                {
                    MessageBox.Show("Data is updated");
                }
                connect.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // after saving open previous screen
            this.Hide();
            selectPatient sp = new selectPatient();

            sp.Show();
        }