コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            connect1();
            OracleCommand cm = new OracleCommand();

            cm.Connection  = conn;
            cm.CommandText = "delete from po_details where porder_id=" + oid + "";
            cm.CommandType = CommandType.Text;
            cm.ExecuteNonQuery();

            OracleCommand cm1 = new OracleCommand();

            for (int i = 0; i < len; i++)
            {
                cm1.Connection  = conn;
                cm1.CommandText = "update product set stock=" + pqty[i + 1] + " where prod_id=" + (i + 1) + "";
                cm1.CommandType = CommandType.Text;
                cm1.ExecuteNonQuery();
            }
            emp f2 = new emp();

            f2.Show();
            this.Dispose();
            conn.Close();
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            connect1();
            OracleCommand cm1 = new OracleCommand();

            cm1.Connection = conn;
            String s = extract_date();

            Console.WriteLine(s + Form1.cust_id1);
            cm1.CommandText = "insert into purchase_order values(" + oid + "," + Form1.cust_id1 + ",'" + s + "'," + ((oid % 4) + 1) + ")";
            cm1.CommandType = CommandType.Text;
            cm1.ExecuteNonQuery();

            conn.Close();
            emp f2 = new emp();

            f2.Show();
            this.Dispose();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            String s = "";

            if (radioButton2.Checked == true)
            {
                connect1();
                comm             = new OracleCommand();
                comm.CommandText = "select* from employee";
                comm.CommandType = CommandType.Text;
                ds = new DataSet();
                da = new OracleDataAdapter(comm.CommandText, conn);
                da.Fill(ds, "employee");
                dt = ds.Tables["employee"];
                int t = dt.Rows.Count;
                dr = dt.Rows[i];
                String s1, s2;
                int    len = t;
                int    j   = 0;
                String user;
                user = textBox1.Text;
                pass = textBox2.Text;
                int flag = 0;
                while (j < len)
                {
                    dr = dt.Rows[j];
                    s1 = dr["emp_ID"].ToString();
                    s2 = dr["password"].ToString();
                    if (s1.Equals(user) && s2.Equals(pass))
                    {
                        // MessageBox.Show("Logged In!");
                        flag      = 1;
                        cust_id1  = Int32.Parse(s1);
                        cust_name = dr["emp_name"].ToString();
                        Console.WriteLine(cust_name);
                        address          = dr["address"].ToString();
                        comm.CommandText = "select* from emp_phone where emp_id=" + s1 + "";
                        comm.CommandType = CommandType.Text;
                        ds = new DataSet();
                        da = new OracleDataAdapter(comm.CommandText, conn);
                        da.Fill(ds, "emp_phone");
                        dt    = ds.Tables["emp_phone"];
                        dr    = dt.Rows[i];
                        phone = dr["phone"].ToString();
                        emp f2 = new emp();
                        f2.Show();
                        this.Hide();
                        break;
                    }
                    j++;
                }
                if (flag == 0)
                {
                    MessageBox.Show("Wrong Username/Password");
                    //new Form1().Show();
                }
                //comm.ExecuteNonQuery();
                conn.Close();
            }
            else
            {
                connect1();
                comm             = new OracleCommand();
                comm.CommandText = "select* from customer";
                comm.CommandType = CommandType.Text;
                ds = new DataSet();
                da = new OracleDataAdapter(comm.CommandText, conn);
                da.Fill(ds, "customer");
                dt = ds.Tables["customer"];
                int t = dt.Rows.Count;
                dr = dt.Rows[i];
                String s1, s2;
                int    len = t;
                int    j   = 0;
                String user;
                user = textBox1.Text;
                pass = textBox2.Text;
                int flag = 0;
                while (j < len)
                {
                    dr = dt.Rows[j];
                    s1 = dr["cust_ID"].ToString();
                    s2 = dr["password"].ToString();
                    if (s1.Equals(user) && s2.Equals(pass))
                    {
                        // MessageBox.Show("Logged In!");
                        flag      = 1;
                        cust_id1  = Int32.Parse(s1);
                        cust_name = dr["cus_name"].ToString();
                        Console.WriteLine(cust_name);
                        address          = dr["address"].ToString();
                        comm.CommandText = "select* from cust_phone where cust_id=" + s1 + "";
                        comm.CommandType = CommandType.Text;
                        ds = new DataSet();
                        da = new OracleDataAdapter(comm.CommandText, conn);
                        da.Fill(ds, "cust_phone");
                        dt    = ds.Tables["cust_phone"];
                        dr    = dt.Rows[i];
                        phone = dr["phone"].ToString();
                        Form2 f2 = new Form2();
                        f2.Show();
                        this.Hide();
                        break;
                    }
                    j++;
                }
                if (flag == 0)
                {
                    MessageBox.Show("Wrong Username/Password");
                    //new Form1().Show();
                }
                //comm.ExecuteNonQuery();
                conn.Close();
            }
        }