//更新一本书

        //0:更新失败
        //1:更新成功
        //2:连接出错,更新失败
        //3:图片为空,更新失败
        //4:ID为空,更新失败
        //
        public int update(Model.Book book)
        {
            string id        = book.Id;
            string name      = book.Name;
            string author    = book.Author;
            string publisher = book.Publisher;


            string pubtime = book.Pubtime;
            string pritime = book.Pritime;

            string edition    = book.Edition;
            string impression = book.Impression;

            string pages = book.Pages;
            string words = book.Words;

            string format    = book.Format;
            string paper     = book.Paper;
            string packaging = book.Packaging;

            string isbn = book.Isbn;

            byte[] picture   = book.Picture;
            string price     = book.Price;
            string sort      = book.Sort;
            string inventory = book.Inventory;


            //判断连接
            if (DbHelper.checkConnection() == false)
            {
                return(2);
            }

            if (picture == null)
            {
                return(3);
            }

            if (id == null || id == "")
            {
                return(4);
            }

            string cmdText = "update book set b_name='" + name + "',b_author='" + author + "',b_publisher='" + publisher + "',b_pubtime='" + pubtime + "',b_pritime='" + pritime + "',b_edition='" + edition + "',b_impression='" + impression + "',b_pages='" + pages + "',b_words='" + words + "',b_format='" + format + "',b_paper='" + paper + "',b_packaging='" + packaging + "',b_isbn='" + isbn + "',b_picture=@picture,b_price='" + price + "',b_sort='" + sort + "',b_inventory='" + inventory + "' where b_id='" + id + "'";

            SqlParameter[] parameters = { new SqlParameter("@picture", SqlDbType.Binary) };
            parameters[0].Value = picture;

            int i = DbHelper.ExecuteNonQuery(cmdText, parameters);

            if (i == 1)
            {
                return(1);
            }
            else
            {
                Console.WriteLine("更新失败");
                return(0);
            }
        }