Ejemplo n.º 1
0
        public ArrayList select(String sql)
        {
            con      = connect("COOK_BOOK");
            this.sql = sql;
            SqlCommand    com      = new SqlCommand(sql, con);
            SqlDataReader reader   = com.ExecuteReader();
            ArrayList     ingNames = new ArrayList();
            Ingredients   c        = null;

            while (reader.Read())
            {
                c = new Ingredients();
                reader.Read();
                c.IngredientID = Convert.ToInt32(reader["ingid"]);
                c.Name         = Convert.ToString(reader["name"]);
                c.Quanity      = Convert.ToInt32(reader["quanity"]);
                c.Unit         = Convert.ToString(reader["unit"]);
                ingNames.Add(c);
            }
            return(ingNames);
        }
Ejemplo n.º 2
0
        public int update(Ingredients i)
        {
            SqlParameter idParam   = new SqlParameter("@ingid", SqlDbType.BigInt, 10);
            SqlParameter nameParam = new SqlParameter("@name", SqlDbType.Text, 50);
            SqlParameter quanParam = new SqlParameter("@quanity", SqlDbType.Text, 100);
            SqlParameter unitParam = new SqlParameter("@unit", SqlDbType.Text, 1000);

            idParam.Value   = i.IngredientID;
            nameParam.Value = i.Name;
            quanParam.Value = i.Quanity;
            unitParam.Value = i.Unit;
            con             = connect("COOK_BOOK");
            sql             = "update into Ingredients set name = @name, quanity = @quanity, unit = @unit where ingredientid = @ingid";
            SqlCommand com = new SqlCommand(null, con);

            com.CommandText = sql;
            com.Parameters.Add(nameParam);
            com.Parameters.Add(quanParam);
            com.Parameters.Add(unitParam);
            com.Prepare();
            int res = com.ExecuteNonQuery();

            return(res);
        }
Ejemplo n.º 3
0
 internal static void Add(Ingredients value)
 {
     throw new NotImplementedException();
 }