コード例 #1
0
        public static bool Update(ITEM item)
        {
            if (item.Update())
            {
                return(true);
            }


            return(false);
        }
コード例 #2
0
        public bool Create()
        {
            using (SqlConnection connection = new SqlConnection(CONSTANT.connectBD))
            {
                ITEM.Create();

                ID_ITEM_KATEGOR = Guid.NewGuid().ToString();
                string sqlExpression = @"
                  INSERT INTO [SPAVREMONT].[ITEM_KATEGOR]
                       (
                       [ID_ITEM_KATEGOR]
                      ,[ID_ITEM]
                      ,[ID_KATEGOR]                     
                  )
                    VALUES
                    (
                      '" + ID_ITEM_KATEGOR + @"',
                      '" + ITEM.ID_ITEM + @"',
                      '" + KATEGOR.ID_KATEGOR + @"'
                    )
                ";



                connection.Open();
                SqlCommand command = new SqlCommand();
                command.CommandText = sqlExpression;
                command.Connection  = connection;
                int numbInsUser = command.ExecuteNonQuery();

                // если успешно вставились данные
                if (numbInsUser > 0)
                {
                    return(true);
                }
            }

            return(false);
        }