kentico中提示Message: An invalid SQL query was used.

在调用CMSAbstractWebPart类的GetValue方法的时候出错。


namespace CMS.PortalEngine.Web.UI
{
/// <summary>
/// Base class for the web part controls.
/// </summary>
[DebuggerDisplay("CMSAbstractWebPart({WebPartID})")]
public abstract partial class CMSAbstractWebPart : AbstractUserControl, ICMSVariantsControl, ITimeZoneManager, IDataControl, ISimpleDataContainer, IExceptionHandler

/// <summary>
/// Returns the value of the given web part property property.
/// </summary>
/// <param name="propertyName">Property name</param>
public virtual object GetValue(string propertyName)
{
return GetValueInternal(propertyName, true);
}

https://devnet.kentico.com/questions/invalid-sql-query-error-on-a-page

Go to settings -> System -> Debug and enable SQL query debug.

Now go to Debug -> SQL queries tab and now you will be able to see detail error log for SQL

Remember to check "Show complete context"

最后发现是一个名为orderby的property存储了非法字符&

原文地址:https://www.cnblogs.com/chucklu/p/7920915.html