public void TestModifyBook() { bookDataSource bookDataSource = new bookDataSource(); Book book = new Book(); book.Book_Name = "用AngularJS开发下一代Web"; book.Book_Sign = "angularjs"; book.Book_Author = "Brad"; book.Book_Enable = "true"; book.Book_Type = "conputer"; book.Book_Description = "AngularJS是一款来自Google的前端JS框架,它的核心特性有:MVC、双向数据绑定、指令和语义化标签、模块化工具、依赖注入、HTML模板,以及对常用工具的封装,例如$http、$cookies、$location等。AngularJS框架的体积非常小,但是设计理念和功能却非常强大,值得前端开发者深入学习。本书对AngularJS框架的核心特性做了全面的介绍,包括常用的开发工具和开发环境。作为国内第一本关于AngularJS的书籍,本书是学习AngularJS的必备入门工具。"; book.Book_ImgUrl = "..\\\\img\\\\angularjs.jpg"; book.Book_ShowType = "计算机"; book.Book_Position = "第二排第三列"; Book result = bookDataSource.Modify(book); Assert.IsNotNull(result); }
//修改数据 public Book Modify(Book book) { var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("UpdateBookItem"); cmd.SetParameterValue("@Book_Name", book.Book_Name); cmd.SetParameterValue("@Book_Sign", book.Book_Sign); cmd.SetParameterValue("@Book_Author", book.Book_Author); cmd.SetParameterValue("@Book_Enable", book.Book_Enable); cmd.SetParameterValue("@Book_Type", book.Book_Type); cmd.SetParameterValue("@Book_Description", book.Book_Description); cmd.SetParameterValue("@Book_ImgUrl", book.Book_ImgUrl); cmd.SetParameterValue("@Book_ShowType", book.Book_ShowType); cmd.SetParameterValue("@Book_Position", book.Book_Position); var res = cmd.ExecuteNonQuery(); if (res == 0) { return null; } return book; }