在 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