コード例 #1
0
ファイル: Form1.cs プロジェクト: B-Rich/Task37774
        private void arkRoyalToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            int weight = 0;
            string str = "";
            string sql = "SELECT * FROM Ships WHERE ID = 1";

            OleDbCommand command = new OleDbCommand(sql, connection);
            OleDbDataReader dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                str = dataReader["Weight"].ToString();
                // listShips.Items.Add(dataReader["ShipName"]);
             //   listShips.Items.Add(str);
            }
            weight = int.Parse(str) / 2;
            dataReader.Close();
            str = null;
            sql = "SELECT * FROM Loading WHERE ShipID = 1";
            command = new OleDbCommand(sql, connection);
            dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                str = dataReader["Quantity"].ToString();
                // listShips.Items.Add(dataReader["ShipName"]);
                //   listShips.Items.Add(str);
            }
            dataReader.Close();
            if (str != null)
            {
                weight = weight - int.Parse(str);
            }

            Cargo c = new Cargo(weight, 1, connection);
            c.Show();
            c.Activate();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: B-Rich/Task37774
        private void bataviaToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            int weight = 0;
            string str = "";
            string sql = "SELECT * FROM Ships WHERE ID = 2";

            OleDbCommand command = new OleDbCommand(sql, connection);
            OleDbDataReader dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                str = dataReader["Weight"].ToString();
                // listShips.Items.Add(dataReader["ShipName"]);
                //   listShips.Items.Add(str);
            }
            weight = int.Parse(str) / 2;
            dataReader.Close();

            Cargo c = new Cargo(weight, 2, connection);
            c.Show();
            c.Activate();
        }