在 FETCH 语句中选项 NEXT 的用法无效。


原因是sqlserver2008不支持此语法

 

一般修改方法:修改“StartUp.cs”文件

        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();

            var connection = @"Data Source=.;
Initial Catalog=xxx;Persist Security Info=True;User ID=xxxx;Password=xxxxx";
            services.AddDbContext<NoteContext>(options => options.UseSqlServer(connection, b => b.UseRowNumberForPaging()));

            services.AddScoped<Repository.INoteRepository, Repository.NoteRepository>();
            services.AddScoped<Repository.INoteTypeRepository, Repository.NoteTypeRepository>();
        }

abp修改方法:修改DbContextConfigurer

    public static class PhoneBookDbContextConfigurer
    {
        public static void Configure(DbContextOptionsBuilder<PhoneBookDbContext> builder, string connectionString)
        {
            builder.UseSqlServer(connectionString, b => b.UseRowNumberForPaging());//解决sqlserver2008不支持FETCH、NEXT
        }

        public static void Configure(DbContextOptionsBuilder<PhoneBookDbContext> builder, DbConnection connection)
        {
            builder.UseSqlServer(connection, b => b.UseRowNumberForPaging());//解决sqlserver2008不支持FETCH、NEXT
        }
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM