Entity FrameWork 取表中字段的最大值

            int? max = (from t in context.Test
                        select (int?)t.ID).Max();
            int m = 0;
            if (!max.HasValue)
            {
                m = 1;
            }
            else
                m = (int)max + 1;
posted on 2013-08-08 17:41  wuzx-blog  阅读(688)  评论(0编辑  收藏  举报