日期:2014-05-17 浏览次数:21032 次
public void NewsUpdate(r_NewsEntity newsEntity)
{
r_NewsEntity updateEntity = dataBase.r_News.Single(p => p.NewsID == newsEntity.NewsID);
updateEntity = newsEntity;
dataBase.SubmitChanges();
}
[Serializable]
[Table(Name="r_News")]
//r_News表的实体
public class r_NewsEntity
{
#region 列名
[Column(Name = "NewsID", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
public int NewsID
{
get;
set;
}
[Column(Name = "NewsTitle", DbType = "NVarChar(100) NOT NULL")]
public string NewsTitle
{
get;
set;
}
[Column(Name = "NewsTypeID", DbType = "Int NOT NULL")]
public int NewsTypeID
{
get;
set;
}
[Column(Name = "NewsImage", DbType = "NVarChar(50)")]
public string NewsImage
{
get;