コード例 #1
0
        public int addNewStore(Storeroom storeroom)
        {
            MySqlCommand sqlComm = new MySqlCommand("INSERT INTO" + " storeroom(description,storingQty,temperature,availability)" +
                                                    " VALUES" + " (@description,@storingQty,@temperature,@availability)", MysqlDbc.Instance.getConn());

            sqlComm.Parameters.Add("@description", MySqlDbType.Text).Value    = storeroom.Description;
            sqlComm.Parameters.Add("@storingQty", MySqlDbType.UInt32).Value   = storeroom.StoringQty;
            sqlComm.Parameters.Add("@temperature", MySqlDbType.Text).Value    = storeroom.Temperature;
            sqlComm.Parameters.Add("@availability", MySqlDbType.UInt64).Value = storeroom.Availability;

            return(sqlComm.ExecuteNonQuery());
        }
コード例 #2
0
        public int updateStore(Storeroom storeroom)
        {
            string query = "UPDATE" + " storeroom SET description=@description,storingQty=@storingQty,temperature=@temperature,availability=@availabitily " +
                           "WHERE id = " + storeroom.Id;
            MySqlCommand sqlComm = new MySqlCommand(query, MysqlDbc.Instance.getConn());

            sqlComm.Parameters.Add("@description", MySqlDbType.Text).Value    = storeroom.Description;
            sqlComm.Parameters.Add("@storingQty", MySqlDbType.UInt32).Value   = storeroom.StoringQty;
            sqlComm.Parameters.Add("@temperature", MySqlDbType.UInt32).Value  = storeroom.Temperature;
            sqlComm.Parameters.Add("@availability", MySqlDbType.UInt64).Value = storeroom.Availability;

            return(sqlComm.ExecuteNonQuery());
        }