diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 38ba3c9c8..a83fb2a18 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -2422,7 +2422,7 @@ namespace SqlSugar if (this.QueryBuilder.AsTables != null && this.QueryBuilder.AsTables.Count==1) { var tableinfo = this.QueryBuilder.AsTables.First(); - if (this.Context.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockQuery == true) + if (this.Context.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockQuery == true&& this.QueryBuilder.AsTables.First().Value.ObjToString().Contains(SqlWith.NoLock) ==false) { this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + $" {SqlWith.NoLock} )"; }