标签归档 Entities实体

通过孟繁永

.net Entities添加实体并获取其自增长ID

TongnianEntities _entities = new TongnianModel.TongnianEntities();

music_Song song = new music_Song();
song.Title = TextBoxTitle.Text.Trim();
_entities.AddToSongSet(song);
_entities.SaveChanges();

Response.Redirect(“AddFileToSong.aspx?SongId=” + song.SongId.ToString());

原来就是这么简单。