Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                connection CN = new connection();
                CN.thisConnection.Open();
                // OracleCommand thisCommand = new OracleCommand();
                OracleCommand thisCommand1 = new OracleCommand();
                thisCommand1.Connection = CN.thisConnection;
                {
                    thisCommand1.CommandText = " SELECT MAX(U_ID) FROM USERS";
                    int id = Convert.ToInt32(thisCommand1.ExecuteScalar());
                    id++;
                    CN.thisConnection.Close();
                    CN.thisConnection.Open();
                    OracleCommand thisCommand = new OracleCommand();
                    thisCommand.Connection  = CN.thisConnection;
                    thisCommand.CommandText = "insert into users values( " + id + ",'" + textBox1.Text + "','" + textBox5.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','no')";
                    OracleDataReader thisReader = thisCommand.ExecuteReader();
                    DataTable        dataTable  = new DataTable();
                    dataTable.Load(thisReader);

                    MessageBox.Show("Applied");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            connection sv = new connection();

            sv.thisConnection.Open();
            OracleCommand thisCommand = sv.thisConnection.CreateCommand();

            thisCommand.CommandText =
                "update applicant set status = '" + textBox2.Text + "'where u_id= '" + textBox1.Text + "'";

            thisCommand.Connection  = sv.thisConnection;
            thisCommand.CommandType = CommandType.Text;
            //For Insert Data Into Oracle//
            try
            {
                thisCommand.ExecuteNonQuery();
                MessageBox.Show("Updated");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            sv.thisConnection.Close();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         connection CN = new connection();
         CN.thisConnection.Open();
         OracleCommand thisCommand = new OracleCommand();
         thisCommand.Connection = CN.thisConnection;
         if (textBox1.Text == "admin")
         {
             thisCommand.CommandText = "SELECT * FROM admin WHERE name='" + textBox1.Text + "' AND password='******'";
             OracleDataReader thisReader = thisCommand.ExecuteReader();
             if (thisReader.Read())
             {
                 Admin1 newForm3 = new Admin1();
                 newForm3.Show();
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("username or password incorrect");
             }
         }
         else
         {
             thisCommand.CommandText = "SELECT * FROM users WHERE u_name='" + textBox1.Text + "' AND password='******'";
             OracleDataReader thisReader = thisCommand.ExecuteReader();
             if (thisReader.Read())
             {
                 Form5 newForm5 = new Form5();
                 newForm5.Show();
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("username or password incorrect");
             }
         }
         //this.Close();
         CN.thisConnection.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 4
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                connection CN = new connection();
                CN.thisConnection.Open();
                OracleCommand thisCommand = new OracleCommand();
                thisCommand.Connection = CN.thisConnection;
                {
                    thisCommand.CommandText = "select * from applicant where status = 'yes'";
                    OracleDataReader thisReader = thisCommand.ExecuteReader();
                    DataTable        dataTable  = new DataTable();
                    dataTable.Load(thisReader);
                    dataGridView1.DataSource = dataTable;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            /* connection sv = new connection();
             * sv.thisConnection.Open();
             * OracleCommand thisCommand = sv.thisConnection.CreateCommand();
             *
             * thisCommand.CommandText =
             *   "update users set status = '" + textBox2.Text + "'where u_id= '" + textBox1.Text + "'";
             *
             * thisCommand.Connection = sv.thisConnection;
             * thisCommand.CommandType = CommandType.Text;
             * //For Insert Data Into Oracle//
             * try
             * {
             *   thisCommand.ExecuteNonQuery();
             *   MessageBox.Show("Updated");
             *
             * }
             * catch (Exception ex)
             * {
             *   Console.WriteLine(ex.Message);
             * }
             *
             * sv.thisConnection.Close();
             */
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                connection CN = new connection();
                CN.thisConnection.Open();
                OracleCommand thisCommand = new OracleCommand();
                thisCommand.Connection = CN.thisConnection;
                {
                    thisCommand.CommandText = "select u_name from users where u_id ='" + textBox1.Text + "'";

                    textBox2.Text = Convert.ToString(thisCommand.ExecuteScalar());
                    CN.thisConnection.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 6
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         connection CN = new connection();
         CN.thisConnection.Open();
         OracleCommand thisCommand = new OracleCommand();
         thisCommand.Connection = CN.thisConnection;
         {
             thisCommand.CommandText = "select * from users";
             OracleDataReader thisReader = thisCommand.ExecuteReader();
             DataTable        dataTable  = new DataTable();
             dataTable.Load(thisReader);
             dataGridView1.DataSource = dataTable;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                connection CN = new connection();
                CN.thisConnection.Open();
                OracleCommand thisCommand = new OracleCommand();
                thisCommand.Connection = CN.thisConnection;
                {
                    thisCommand.CommandText = "insert into applicant values( '" + Int32.Parse(textBox1.Text) + "','" + textBox2.Text + "','" + dateTimePicker1.Value.ToString("dd/MM/yyyy") + "','" + dateTimePicker2.Value.ToString("dd/MM/yyyy") + "','no')";
                    OracleDataReader thisReader = thisCommand.ExecuteReader();
                    DataTable        dataTable  = new DataTable();
                    dataTable.Load(thisReader);

                    MessageBox.Show("Applied");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }