Esempio n. 1
0
      // this method is for adding
      // the order of parameters should be the same as the stored proc inthe database

      public void Add_Cloth(int id_cat, String item_id, String item_label,
                            int quanitity, String price, int sub_id, byte[] image)
      {
          DAL.DataAccesssLayer Dal = new DAL.DataAccesssLayer();
          Dal.Open();
          SqlParameter[] param = new SqlParameter[7];

          param[0]       = new SqlParameter("@id_cat", SqlDbType.Int);
          param[0].Value = id_cat;

          param[1]       = new SqlParameter("@item_id", SqlDbType.VarChar, 30);
          param[1].Value = item_id;

          param[2]       = new SqlParameter("@item_label", SqlDbType.VarChar, 50);
          param[2].Value = item_label;

          param[3]       = new SqlParameter("@quantity", SqlDbType.Int);
          param[3].Value = quanitity;

          param[4]       = new SqlParameter("@price", SqlDbType.VarChar, 20);
          param[4].Value = price;

          param[5]       = new SqlParameter("@sub_id", SqlDbType.Int);
          param[5].Value = sub_id;
          param[6]       = new SqlParameter("@item_image", SqlDbType.Image);
          param[6].Value = image;

          Dal.ExecuteUpdate("ADD_Cloth", param);
          Dal.Close();
      }
Esempio n. 2
0
      public byte[] Get_images(string id)
      {
          DAL.DataAccesssLayer dal = new DAL.DataAccesssLayer();
          String qu = " select * from Items where Item_id=" + id + ";";

          dal.Open();

          SqlDataReader dr = dal.Execut(qu);

          // dal.Close();
          dr.Read();
          byte[] buteimg = null;

          buteimg = (byte[])dr["Item_image"];

          // MemoryStream ms = new MemoryStream(buteimg);
          return(buteimg);
      }
Esempio n. 3
0
        // these parameter willbe snet to te stored proc in the databse

        public DataTable Login(String id, String pass)
        {
            // this method is for calling the stored procedure
            // ths equals the callable ststment java Video 89
            // every data base has its own language to store stored procedure
            DAL.DataAccesssLayer Dal   = new DAL.DataAccesssLayer();
            SqlParameter[]       param = new SqlParameter[2];

            param[0]       = new SqlParameter("@ID", SqlDbType.VarChar, 20);
            param[0].Value = id;

            param[1]       = new SqlParameter("@pasword", SqlDbType.VarChar, 20);
            param[1].Value = pass;

            Dal.Open();
            DataTable dt = new DataTable();

            // this will pass the name of the procedure
            // and the method will deal with the prcedure
            // the load of the sql statment will be dine in the server
            dt = Dal.ExecutQuery("logIn", param);
            Dal.Close();
            return(dt);
        }