/// <summary> /// 保存文章到数据库 /// </summary> /// <param name="article"></param> /// <returns></returns> public bool SaveArticle(Article.Model.Article article) { string sql = "select * from Article where contentId =" + article.getContentId(); dt = conn.ExecuteDataTable(sql); if (dt.Rows.Count == 0) { string sqlInsert = "INSERT INTO 'Article' ('user', 'txt', 'description', 'contentId', 'isArticle', 'channelId', 'releaseDate', 'title', 'isRecommend', 'views', 'comments', 'stows', 'toplevel', 'cover', 'viewOnly') VALUES ('" + article.getUser() + "', '" + article.getTxt() + "', '" + article.getDescription() + "', '" + article.getContentId() + "', '" + article.getIsArticle() + "', '" + article.getChannelId() + "', '" + article.getReleaseDate() + "', '" + article.getTitle() + "', '" + article.getIsRecommend() + "', '" + article.getViews() + "', '" + article.getComments() + "', '" + article .getStows() + "', '" + article.getToplevel() + "', '" + article.getCover() + "', '" + article.getViewOnly() + "');"; conn.ExecuteScalar(sqlInsert); } return(true); }