Exemple #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            string var;

            var = comboBox1.Text;


            string           connetionString = "Provider=OraOLEDB.Oracle;Data Source=orcl;User Id=bms;Password=bmscse;";
            string           sql2            = "SELECT count(*) FROM media";
            string           a           = CreateReader(connetionString, sql2);
            int              x           = int.Parse(a);
            Random           rnd         = new Random();
            int              m           = rnd.Next(1, 20);
            int              b           = x + m;
            string           sql1        = "Insert into media VALUES ('" + b + "', '" + textBox1.Text + "' ,'" + textBox4.Text + "','" + var + "','" + textBox3.Text + "')";
            OleDbConnection  connection  = new OleDbConnection(connetionString);
            OleDbDataAdapter dataadapter = new OleDbDataAdapter(sql1, connection);

            dataadapter.InsertCommand = new OleDbCommand(sql1, connection);
            connection.Open();
            dataadapter.InsertCommand.ExecuteNonQuery();
            MessageBox.Show("SUCESS");
            connection.Close();
            admin1 y = new admin1();

            y.Show();
            this.Hide();
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            admin1 a = new admin1();

            a.Show();
            this.Hide();
        }
Exemple #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            string connetionString = "Provider=OraOLEDB.Oracle;Data Source=orcl;User Id=bms;Password=bmscse;";

            if (radioButton2.Checked == true)
            {
                String           sql2        = "SELECT username FROM register where username='******'and pwd='" + textBox2.Text + "'";
                OleDbConnection  connection  = new OleDbConnection(connetionString);
                OleDbDataAdapter dataadapter = new OleDbDataAdapter(sql2, connection);
                connection.Open();
                DataTable dt = new DataTable();

                dataadapter.Fill(dt);
                connection.Close();



                if (dt.Rows.Count == 1)
                {
                    string a = textBox1.Text.ToString();
                    user1  u = new user1(a);
                    u.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Incorrect Details");
                }
            }

            else if (radioButton1.Checked == true)
            {
                String           sql3        = "SELECT username FROM admin where username='******'and pwd='" + textBox2.Text + "'";
                OleDbConnection  connection  = new OleDbConnection(connetionString);
                OleDbDataAdapter dataadapter = new OleDbDataAdapter(sql3, connection);
                connection.Open();
                DataTable dt = new DataTable();
                dataadapter.Fill(dt);
                connection.Close();



                if (dt.Rows.Count == 1)
                {
                    admin1 a = new admin1();
                    a.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Incorrect Details");
                }
            }
        }