开发者

linq SubmitChanges method isn't working

开发者 https://www.devze.com 2023-02-04 13:25 出处:网络
I am using a simple code as follows: DataCla开发者_开发问答sses1DataContext context = new DataClasses1DataContext();

I am using a simple code as follows:

        DataCla开发者_开发问答sses1DataContext context = new DataClasses1DataContext();

        order oder = context.orders.Single(p => p.order_no == 3);

        oder.ship_to_name = "test rana";
        context.SubmitChanges();  

However data isn't saving to sqlserver db. What have i missed? I have been trying basic linq tutorial

Regards


Does the orders table have a primary key? If not, then you wouldn't be able to perform updates.

0

精彩评论

暂无评论...
验证码 换一张
取 消