但打算拿掉了 XDD
先記錄下來
LinqClassesDataContext linqdc = new LinqDataClassesDataContext();
Order ord = new Order
{
No = ComputeNo(),
PersonID = PersonID,
ProjectNo = ProjectNo,
Reason = Reason,
Date = DateTime.Today
};
linqdc.GetTable<Order>().InsertOnSubmit(ord);
linqdc.SubmitChanges();
[Table(Name = "dbo.OrderMain")]
public class Order //新增
{
[Column(IsPrimaryKey = true)]
public string OrderNo { get; set; }
[Column]
public string PersonID { get; set; }
[Column]
public int ProjectNo { get; set; }
[Column]
public string Reason { get; set; }
[Column]
public DateTime Date { get; set; }
}
對了 前面記得加上
using System.Data.Linq;
using System.Data.Linq.Mapping;
如果是自己產生的欄位加入IsDbGenerated=true
沒有留言:
張貼留言