Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            connection.Open();
            OleDbDataAdapter da1 = new OleDbDataAdapter("select * from userDetail", connection);
            DataSet          ds1 = new DataSet();

            da1.Fill(ds1);

            string id    = "";
            int    count = 0;

            for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
            {
                if (ds1.Tables[0].Rows[i][4].ToString() == "true")
                {
                    id = ds1.Tables[0].Rows[i][0].ToString();
                }
            }

            OleDbDataAdapter da2 = new OleDbDataAdapter("select * from menu", connection);
            DataSet          ds2 = new DataSet();

            da2.Fill(ds2);

            for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
            {
                if (ds2.Tables[0].Rows[i][4].ToString() == "true")
                {
                    count++;
                }
            }

            int t = 0;

            string[] temp = new string[4] {
                "", "", "", ""
            };
            for (int j = 0; j < ds2.Tables[0].Rows.Count; j++)
            {
                if (ds2.Tables[0].Rows[j][4].ToString() == "true")
                {
                    temp[t] = ds2.Tables[0].Rows[j][0].ToString();
                    t++;
                }

                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection  = connection;
                cmd.CommandText = "update userDetail set mID1 = '" + temp[0] + "', mID2 = '" + temp[1] + "', mID3 = '" + temp[2] + "', mID4 = '" + temp[3] + "' where userID = '" + id + "'";
                cmd.ExecuteNonQuery();
            }

            connection.Close();

            orderPage op = new orderPage();

            op.ShowDialog();
        }
        private void btnOrder_Click(object sender, EventArgs e)
        {
            orderPage op = new orderPage();

            op.ShowDialog();
        }