Server Error in '/' Application.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Rank
from documentcategoryname n,
(
select documentcategoryid, 1 as lev from ' at line 1

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Rank
from documentcategoryname n,
(
select documentcategoryid, 1 as lev from ' at line 1

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Rank
from documentcategoryname n,
(
select documentcategoryid, 1 as lev from ' at line 1]
   MySql.Data.MySqlClient.<ReadPacketAsync>d__30.MoveNext() +595
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   MySql.Data.MySqlClient.<GetResultAsync>d__45.MoveNext() +2451
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   MySql.Data.MySqlClient.<GetResultAsync>d__85.MoveNext() +339
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   MySql.Data.MySqlClient.<NextResultAsync>d__84.MoveNext() +411
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   MySql.Data.MySqlClient.<NextResultAsync>d__97.MoveNext() +1311
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   MySql.Data.MySqlClient.<NextResultAsync>d__97.MoveNext() +4467
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   MySql.Data.MySqlClient.<ExecuteReaderAsync>d__111.MoveNext() +3446
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   MySql.Data.MySqlClient.<ExecuteReaderAsync>d__111.MoveNext() +5670
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   MySql.Data.MySqlClient.<ExecuteReaderAsync>d__111.MoveNext() +6845
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +46
   StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) +103
   Dapper.<QueryInternal>d__18`1.MoveNext() in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\Dapper\Dapper\SqlMapper.cs:413
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +453
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +69
   Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\Dapper\Dapper\SqlMapper.cs:350
   ImageShop.DAL.MySqlConnector.MySqlDALBase.Execute(String sql, Object parm) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShop.DAL.Mysql\MySqlDALBase.cs:37
   ImageShop.DAL.MySqlConnector.MySqlCategoryDAL.LoadFlatSubCategoryList(Int32 parentID, Int32 languageID) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShop.DAL.Mysql\MySqlCategoryDAL.cs:59
   ImageShop.Business.InterfaceCategoryLoader.LoadCategoryTree(CustomListFilter typefilter, Boolean loadId) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShop.Business\InterfaceCategoryLoader.cs:946
   ImageShop.Business.InterfaceCategoryLoader.LoadCategoryTreeListForAllFilters(Boolean loadId) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShop.Business\InterfaceCategoryLoader.cs:883
   ImageShop.Business.InterfaceRepository.FillCompleteInterfaceInformation(LanguageInformation language, Interface interfaceWithoutCategories) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShop.Business\InterfaceRepository.cs:110
   ImageShop.Business.InterfaceRepository.LoadInterfaceFromNameForceReload(String interfaceName, LanguageInformation language, Boolean GetAllInformation) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShop.Business\InterfaceRepository.cs:96
   ImageShop.Business.InterfaceRepository.LoadInterfaceFromName(String interfaceName, LanguageInformation language, Boolean GetAllInformation) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShop.Business\InterfaceRepository.cs:77
   ImageShopV4.Controllers.Base.ImageShopBaseController.LoadInterfaceAndPossibleInterfaceList(String interfacename, List`1& interfacelist, Interface& interfaceforthisuser) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShopV4\Controllers\Base\ImageShopBaseController.cs:808
   ImageShopV4.Controllers.Base.ImageShopBaseController.LoadCurrentInterface(String interfacename) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShopV4\Controllers\Base\ImageShopBaseController.cs:789
   ImageShopV4.Controllers.Base.ImageShopBaseController.OnActionExecuting(ActionExecutingContext filterContext) in C:\Users\hogne\Documents\synlighet\Imageshop\imageshopv4\ImageShopV4\Controllers\Base\ImageShopBaseController.cs:60
   System.Web.Mvc.Async.AsyncInvocationWithFilters.InvokeActionMethodFilterAsynchronouslyRecursive(Int32 filterIndex) +268
   System.Web.Mvc.Async.<>c__DisplayClass7_0.<BeginInvokeActionMethodWithFilters>b__0(AsyncCallback asyncCallback, Object asyncState) +100
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters, AsyncCallback callback, Object state) +303
   System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__0(AsyncCallback asyncCallback, Object asyncState) +1082
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +463
   System.Web.Mvc.<>c.<BeginExecuteCore>b__152_0(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +48
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +787
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +630
   System.Web.Mvc.<>c.<BeginProcessRequest>b__20_0(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +99
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +163
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +544
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1128
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +220
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4676.0