public void bookcommentshow(string name)//书评显示 { this.commentList.Controls.Clear(); SqlDataReader bookcomment; string commenter; int i = 1; try { bookcomment = LibraryBLL.book.bookcommentdata(name); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } while (bookcomment.Read()) { commenter = bookcomment["commenter"].ToString().Trim(); LibraryModel.book_Comment bookComment = new book_Comment(); bookComment.name = commenter; bookComment.comment = bookcomment["comment"].ToString(); bookComment.date = bookcomment["date"].ToString(); bookComment.commenterImg = img(commenter); bookComment.floor = i.ToString(); i++; LibrarySET.bookcomment UIcomment = new LibrarySET.bookcomment(bookComment); this.commentList.Controls.Add(UIcomment); } }
public bookcomment(object e) { book_Comment bookComment = new book_Comment(); bookComment = (book_Comment)e; InitializeComponent(); Img.BackgroundImage = bookComment.commenterImg; user.Text = bookComment.name; comment.Text = bookComment.comment; floor.Text = bookComment.floor; date.Text = bookComment.date; }