<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Data;
    using System.Data.SqlClient;
    using domain.SQLDB;
    namespace domain.SQLDB
    {

    public class News{
    private string _Gid;
    private string _TypeId;
    private string _Title;
    private string _Keyword;
    private string _ComeFrom;
    private string _Author;
    private string _Content;
    private string _Pic;
    private string _IsCommand;
    private string _commandTime;
    private string _IsTop;
    private string _topTime;
    private string _AddTime;
    public string Gid{set{this._Gid=value;}get{return this._Gid;}}

    public string TypeId { set { this._TypeId = value; } get { return this._TypeId; } }
    public string Title { set { this._Title = value; } get { return this._Title; } }
        public string Keyword { set { this._Keyword = value; } get { return this._Keyword; } }
    public string ComeFrom{set{this._ComeFrom=value;}get{return this._ComeFrom;}}
    public string Author{set{this._Author=value;}get{return this._Author;}}
    public string Content{set{this._Content=value;}get{return this._Content;}}
    public string Pic{set{this._Pic=value;}get{return this._Pic;}}
    public string IsCommand{set{this._IsCommand=value;}get{return this._IsCommand;}}
    public string commandTime{set{this._commandTime=value;}get{return this._commandTime;}}
    public string IsTop{set{this._IsTop=value;}get{return this._IsTop;}}
    public string topTime{set{this._topTime=value;}get{return this._topTime;}}
    public string AddTime{set{this._AddTime=value;}get{return this._AddTime;}}

    DbAccess db = new DbAccess();
    public bool Add(){
    string sql = "insert into News([Gid],[Title],[ComeFrom],[Author],[Content],[Pic],[IsCommand],[commandTime],[IsTop],[topTime],[AddTime]) values(@Gid,@Title,@ComeFrom,@Author,@Content,@Pic,@IsCommand,@commandTime,@IsTop,@topTime,@AddTime)";
    SqlParameter[] pas = {new SqlParameter("@Gid",Gid),new SqlParameter("@Title",Title),new SqlParameter("@ComeFrom",ComeFrom),new SqlParameter("@Author",Author),new SqlParameter("@Content",Content),new SqlParameter("@Pic",Pic),new SqlParameter("@IsCommand",IsCommand),new SqlParameter("@commandTime",commandTime),new SqlParameter("@IsTop",IsTop),new SqlParameter("@topTime",topTime),new SqlParameter("@AddTime",AddTime)};
    return db.GetState(sql,pas);
    }

    public bool Update()
    {
        string sql = "if exists(select Gid from News where Gid=@Gid) begin  update News set [TypeId]=@TypeId,[Title]=@Title,[Keyword]=@keyword,[ComeFrom]=@ComeFrom,[Author]=@Author,[Content]=@Content,[Pic]=case when len(@Pic)>0 then @Pic else Pic end,[IsCommand]=@IsCommand,[commandTime]=@commandTime,[IsTop]=@IsTop,[topTime]=@topTime where Gid=@Gid end else begin insert into News([TypeId],[Title],[keyword],[ComeFrom],[Author],[Content],[Pic],[IsCommand],[commandTime],[IsTop],[topTime]) values(@TypeId,@Title,@keyword,@ComeFrom,@Author,@Content,@Pic,@IsCommand,@commandTime,@IsTop,@topTime) end";
        SqlParameter[] pas = { new SqlParameter("@Gid", Gid), new SqlParameter("@TypeId", TypeId), new SqlParameter("@Title", Title), new SqlParameter("@keyword", Keyword), new SqlParameter("@ComeFrom", ComeFrom), new SqlParameter("@Author", Author), new SqlParameter("@Content", Content), new SqlParameter("@Pic", Pic), new SqlParameter("@IsCommand", IsCommand), new SqlParameter("@commandTime", commandTime), new SqlParameter("@IsTop", IsTop), new SqlParameter("@topTime", topTime) };
    return db.GetState(sql,pas);
    }

    public bool Delete()
    {string sql = "delete News where [Gid]=@Gid";
    SqlParameter[] pas = {new SqlParameter("@Gid",Gid)};
    return db.GetState(sql,pas);
    }
    public DataTable Select()
    {
    DataTable dt = db.GetTable("select * from News")??new DataTable();
    return dt;
    }
    //查詢
    public News SelectById(){
    News  news = new News();
    string sql = "select * from News where Gid=@Gid";
    SqlParameter[] pas = {new SqlParameter("@Gid",Gid)};
    DataTable dt = db.GetTable(sql,pas);
      if(dt.Rows.Count>0)
        {
          news.Gid=Convert.ToString(dt.Rows[0]["Gid"]);
          news.TypeId = Convert.ToString(dt.Rows[0]["TypeId"]);
          news.Title=Convert.ToString(dt.Rows[0]["Title"]);
          news.Keyword = Convert.ToString(dt.Rows[0]["Keyword"]);     
          news.ComeFrom=Convert.ToString(dt.Rows[0]["ComeFrom"]);
          news.Author=Convert.ToString(dt.Rows[0]["Author"]);
          news.Content=Convert.ToString(dt.Rows[0]["Content"]);
          news.Pic=Convert.ToString(dt.Rows[0]["Pic"]);
          news.IsCommand=Convert.ToString(dt.Rows[0]["IsCommand"]);
          news.commandTime=Convert.ToString(dt.Rows[0]["commandTime"]);
          news.IsTop=Convert.ToString(dt.Rows[0]["IsTop"]);
          news.topTime=Convert.ToString(dt.Rows[0]["topTime"]);
          news.AddTime=Convert.ToString(dt.Rows[0]["AddTime"]);

        }
    return news;
    }

    }
    }

    posted on 2009-06-10 18:20 sanmao 閱讀(99) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
    博客園   IT新聞   Chat2DB   C++博客   博問  
     

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 亚洲精品午夜国产VA久久成人| 在线观看亚洲网站| 亚洲免费精彩视频在线观看| 亚洲精品成人网久久久久久| 亚洲精品国产综合久久久久紧| 免费能直接在线观看黄的视频| 久热综合在线亚洲精品| 久草免费福利在线| 亚洲精品国产自在久久| 午夜亚洲乱码伦小说区69堂| 在线观看成人免费视频| 学生妹亚洲一区二区| 国国内清清草原免费视频99| 亚洲成a人片毛片在线| 9420免费高清在线视频| 亚洲色四在线视频观看| 一级成人a毛片免费播放| 亚洲VA中文字幕无码毛片| 国精产品一区一区三区免费视频 | 精品亚洲av无码一区二区柚蜜| 24小时日本在线www免费的| 亚洲av无码专区在线| 69天堂人成无码麻豆免费视频| 亚洲欧洲日韩在线电影| 亚洲人成免费网站| 亚洲图片激情小说| 永久免费av无码网站韩国毛片| 亚洲人成在线中文字幕| 日本亚洲免费无线码| 91丁香亚洲综合社区| 三年片在线观看免费观看高清电影| 亚洲自国产拍揄拍| 成年美女黄网站色大免费视频| 亚洲精品一二三区| 日本特黄特黄刺激大片免费| 黑人粗长大战亚洲女2021国产精品成人免费视频 | 国产午夜亚洲精品| 午夜毛片不卡高清免费| 久久亚洲色WWW成人欧美| 亚洲第一黄片大全| 久久九九免费高清视频|