日期:2014-05-20  浏览次数:20741 次

为什么我的DataContext没有Add方法!
书上的源码:
C# code

using System;
using System.Linq;
namespace RoomReveration
{
    public class RoomReservationData
    {

        public void ReserveRoom(RoomReservation roomReservation ) {
            using (RoomReservationDataContext data = new RoomReservationDataContext()) {
                data.RoomReservation.Add(roomReservation );
                data.SubmitChanges();
            }
        }
    }
}



而我照着书写的,却点不出那个data.RoomReservation的Add方法,这是为什么?

------解决方案--------------------
用InsertOnSubmit
------解决方案--------------------
Add()是要自已写的
Table<(Of <(TEntity>)>).InsertOnSubmit