+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Server Error: Must declare scalar variable "@CACHESIZE"

Server Error: Must declare scalar variable "@CACHESIZE"

6 posts, 0 answered
  1. Eric P.
    Eric P. avatar
    10 posts
    Registered:
    05 Jul 2007
    02 Jan 2008
    Link to this post

    To evaluate the latest version, I just installed Sitefinity 3.1 SP2 in the default installation folder.
    I'm running a clean installation of Windows XP/SP2 with SQL Server 2005 Express Edition SP2. I configured SQLExpress to enable user instances.

    When I start the Sitefinity Project Manager the 2 sample sites are listed.
    If I click the Browse button to browse the JobsIntraSite, the error below appears.
    The same error appears when clicking Browse in the TIUSite.

    What can I do to solve this?
    Eric

    Server Error in '/telerik/JobsIntraSite' Application.  
    --------------------------------------------------------------------------------  
     
    Must declare the scalar variable "@CACHESIZE".  
    Must declare the scalar variable "@CACHESIZE".   
    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: System.Data.SqlClient.SqlException: Must declare the scalar variable "@CACHESIZE".  
    Must declare the scalar variable "@CACHESIZE".  
     
    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:   
     
     
    [SqlException (0x80131904): Must declare the scalar variable "@CACHESIZE".  
    Must declare the scalar variable "@CACHESIZE".]  
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466  
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118  
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186  
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932  
       System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31  
       System.Data.SqlClient.SqlDataReader.get_MetaData() +62  
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297  
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005  
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132  
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32  
       System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122  
       System.Data.SqlClient.SqlCommand.ExecuteReader() +84  
       Nolics.ORMapper.DataProviders.SqlServer2005Provider.BeginUpdate(Connection con) +224  
       Nolics.ORMapper.DataProviders.SQLDataProvider.Update(DataSet updateData) +90  
       Nolics.ORMapper.Base.Transaction.Commit(Boolean fCleanIfSuccess) +756  
       Nolics.ORMapper.Base.Transaction.Commit() +10  
       Telerik.Search.Data.DefaultProvider.SetVariable(String name, String value, Boolean global) +197  
       Telerik.Search.Data.DefaultProvider.Initialize(String name, NameValueCollection config) +475  
       Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings, Type providerType) +670  
       Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings) +102  
       Telerik.ManagerBase`1.SetProvider(String providerName) +214  
       Telerik.ManagerBase`1..ctor(String providerName) +103  
       Telerik.ManagerBase`1..ctor() +11  
       Telerik.Search.Engine.IndexingManager.Initialize() +44  
       Telerik.Framework.ServiceHost.Initialize() +233  
       Telerik.Cms.Web.CmsHttpModule.Init(HttpApplication context) +102  
       System.Web.HttpApplication.InitModulesCommon() +66  
       System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1006  
       System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +259  
       System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +114  
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +350  
     
    --------------------------------------------------------------------------------  
    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433   
     

  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    02 Jan 2008
    Link to this post
    Hello Eric,

    Thank you for reporting this problem.

    We had the same issue. It was related to Nolics - some of the queries generated by Nolics were not working correctly with a case-sensitive database. After reporting this to Nolics, it was fixed.
    Since the sample sites have an old database created with the previous version of Nolics before the above fix, we suspect
    that the cause of the problem is that your SQL 2005 Express is set as case-sensitive.

    Could  you please try to create a new project? You should not experience the same problem there.

    As for the sample sites, to fix this error, try to update their databases with the following script:

    ALTER PROCEDURE [dbo] . [NN_NextValue] ( @CounterID nvarchar ( 50 ), @CacheSize int ) 
    AS BEGIN 
    update [dbo] . [NN_Counters] SET CounterValue = CounterValue + @CacheSize WHERE CounterID = @CounterID 
    SELECT CounterValue - @CacheSize + 1 AS CounterValue , CounterValue AS MAXVALUE 
    FROM [dbo] . [NN_Counters] WHERE CounterID = @CounterID 
    END  


    Please let us know how it goes.
    Your Telerik points have been updated for reporting this issue.

    Best wishes,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Eric P.
    Eric P. avatar
    10 posts
    Registered:
    05 Jul 2007
    02 Jan 2008
    Link to this post

    Hello Vlad,

    Thank you for your prompt reply!

    You are right about the case-sensitive database: I installed SQL Server 2005 Express Edition with Collation designator set to "Latin1_General", and option "Case-sensitive" checked.

    As you instructed, I tried to create a new project, and that works as expected.

    I need both samplesites, so I tried running your script on both databases. 
    Your script runs fine, but now the error below appears when I try to browse the sites from the Sitefinity Project Manager.

    Just to let you know:

    I added the <computername>\ASPNET account to both Sitefinity databases in their respective folders.
    In SQL Server Management Studio Express I:
    -  attach the Sitefinity.mdf database in the App_Data folder;
    -  expand folder Security / Users and add account <computername>\ASPNET;
    -  in panel Database Role Membership, I check "db_owner";

    That's all I need to do, right?

    Eric


    Server Error in '/telerik/JobsIntraSite' Application.  
    --------------------------------------------------------------------------------  
     
    Cannot open user default database. Login failed.  
    Login failed for user 'GLADIATOR\ASPNET'.   
    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: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.  
    Login failed for user 'GLADIATOR\ASPNET'.  
     
    Source Error:   
    Line 31:     Assembly assembly = typeof(Job).Assembly;  
    Line 32:     DataConnection.Initialize(false, assembly);  
    Line 33:     OdbDataProvider provider = NolicsHelper.SetConnection("DefaultConnection", "Jobs");  
    Line 34:     //Upgrade the database with the defined data objects for the Jobs module.  
    Line 35:     provider.Upgrade();  
       
     
    Source File: c:\Program Files\telerik\Sitefinity3.1\JobsIntraSite\App_Code\JobsModule.cs    Line: 33   
     
    Stack Trace:   
    [SqlException (0x80131904): Cannot open user default database. Login failed.  
    Login failed for user 'GLADIATOR\ASPNET'.]  
       Nolics.ORMapper.DataProviders.SQLDataProvider.Open() +121  
       Telerik.DataAccess.NolicsHelper.SetConnection(String connectionName, String providerName) +604  
       JobsModule..cctor() in c:\Program Files\telerik\Sitefinity3.1\JobsIntraSite\App_Code\JobsModule.cs:33  
     
    [TypeInitializationException: The type initializer for 'JobsModule' threw an exception.]  
     
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]  
       System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0  
       System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103  
       System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +268  
       System.Activator.CreateInstance(Type type, Boolean nonPublic) +66  
       Telerik.ModuleManager.LoadModules(Boolean reload) +1053  
       Telerik.ModuleManager.LoadModules() +25  
       Telerik.ModuleManager..cctor() +96  
     
    [TypeInitializationException: The type initializer for 'Telerik.ModuleManager' threw an exception.]  
       Telerik.ModuleManager.LoadModules(Boolean reload) +0  
       Telerik.Cms.Web.CmsHttpModule..cctor() +38  
     
    [TypeInitializationException: The type initializer for 'Telerik.Cms.Web.CmsHttpModule' threw an exception.]  
     
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]  
       System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0  
       System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103  
       System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +268  
       System.Activator.CreateInstance(Type type, Boolean nonPublic) +66  
       System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036  
       System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114  
       System.Web.Configuration.Common.ModulesEntry.Create() +41  
       System.Web.Configuration.HttpModulesSection.CreateModules() +203  
       System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1006  
       System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +259  
       System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +114  
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +350  
     
    --------------------------------------------------------------------------------  
    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433   
     

  4. Eric P.
    Eric P. avatar
    10 posts
    Registered:
    05 Jul 2007
    02 Jan 2008
    Link to this post

    Hello Vlad,

    I wanted to see if the two samplesites would work when I switched Collation mode to CASE-INSENSITIVE in SQL Server 2005 Express.

    I couldn't figure out how to do this through configurable options, so I decided to uninstall SQLExpress and re-install it with Collation designator set to "Latin1_General" with "Case-insensitive".

    Unfortenately, clicking the Browse link in the Project Manager gave the same error, as shown below.

    What can I do?

    Eric

    Server Error in '/telerik/JobsIntraSite' Application.  
    --------------------------------------------------------------------------------  
     
    Cannot open user default database. Login failed.  
    Login failed for user 'GLADIATOR\ASPNET'.   
    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: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.  
    Login failed for user 'GLADIATOR\ASPNET'.  
     
    Source Error:   
    Line 31:     Assembly assembly = typeof(Job).Assembly;  
    Line 32:     DataConnection.Initialize(false, assembly);  
    Line 33:     OdbDataProvider provider = NolicsHelper.SetConnection("DefaultConnection", "Jobs");  
    Line 34:     //Upgrade the database with the defined data objects for the Jobs module.  
    Line 35:     provider.Upgrade();  
       
     
    Source File: c:\Program Files\telerik\Sitefinity3.1\JobsIntraSite\App_Code\JobsModule.cs    Line: 33   
     
    Stack Trace:   
    [SqlException (0x80131904): Cannot open user default database. Login failed.  
    Login failed for user 'GLADIATOR\ASPNET'.]  
       Nolics.ORMapper.DataProviders.SQLDataProvider.Open() +121  
       Telerik.DataAccess.NolicsHelper.SetConnection(String connectionName, String providerName) +604  
       JobsModule..cctor() in c:\Program Files\telerik\Sitefinity3.1\JobsIntraSite\App_Code\JobsModule.cs:33  
     
    [TypeInitializationException: The type initializer for 'JobsModule' threw an exception.]  
     
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]  
       System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0  
       System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103  
       System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +268  
       System.Activator.CreateInstance(Type type, Boolean nonPublic) +66  
       Telerik.ModuleManager.LoadModules(Boolean reload) +1053  
       Telerik.ModuleManager.LoadModules() +25  
       Telerik.ModuleManager..cctor() +96  
     
    [TypeInitializationException: The type initializer for 'Telerik.ModuleManager' threw an exception.]  
       Telerik.ModuleManager.LoadModules(Boolean reload) +0  
       Telerik.Cms.Web.CmsHttpModule..cctor() +38  
     
    [TypeInitializationException: The type initializer for 'Telerik.Cms.Web.CmsHttpModule' threw an exception.]  
     
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]  
       System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0  
       System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103  
       System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +268  
       System.Activator.CreateInstance(Type type, Boolean nonPublic) +66  
       System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036  
       System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114  
       System.Web.Configuration.Common.ModulesEntry.Create() +41  
       System.Web.Configuration.HttpModulesSection.CreateModules() +203  
       System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1006  
       System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +259  
       System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +114  
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +350  
     
    --------------------------------------------------------------------------------  
    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433   
     

  5. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    03 Jan 2008
    Link to this post
    Hello Eric,

    Installing SQL Express as case-insensitive should make the sample sites work properly without running the script I sent you in my previous post.
    The new error is related to the SQL Express Edition. As it says, the aspnet account (GLADIATOR\ASPNET) does not have permission to the database. Unfortunately, we cannot tell you more without investigating your machine first.

    We are suggesting you to completely uninstall and then install SQL Express again.

    In case the above doesn't help, we could try to fix the problem for you if you provide us a Remote Desktop Connection to your PC.


    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Eric P.
    Eric P. avatar
    10 posts
    Registered:
    05 Jul 2007
    03 Jan 2008
    Link to this post

    Hello Vlad,

    I've completely uninstalled SQL Express, rebooted the machine and re-installed it with case-insensitive.
    Next, I completely uninstalled Sitefinity 3.1 SP2, rebooted, and re-installed it.

    When I click brow in Project Manager, I keep getting the same error.

    I'm through my options, and would like you to take a look remotely.
    I'll mail you an account to <support at telerik.com>.

    My machine is al yours.
    Eric

Register for webinar
6 posts, 0 answered