Error getting categories

Oct 8, 2009 at 8:58 AM

When in debug I seem to be getting this error and am unsure where it originates from.

the stored procedure exists in the database.

Server Error in '/Website' Application.

Could not find stored procedure 'GetCategories'.

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: Could not find stored procedure 'GetCategories'.

Source Error: 

Line 24:         MenuItem Categories = new MenuItem("Shop");
Line 25:         CacheManager cache = new CacheManager();
Line 26:         ListItemCollection categoryCollection = cache.GetCachedCategories(null);
Line 27:         foreach (ListItem item in categoryCollection)
Line 28:         {


Source File: e:\Websites\XDEV\XDEV-Templates\Websites\Ecommerce\Website\UserControls\MenuControl.ascx.cs    Line: 26 

Stack Trace: 

[SqlException (0x80131904): Could not find stored procedure 'GetCategories'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +83
   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) +954
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +70
   InvertedSoftware.ShoppingCart.DataLayer.Helpers.SqlHelper.ExecuteReader(String connectionString, CommandType cmdType, String cmdText, SqlParameter[] commandParameters) +218
   InvertedSoftware.ShoppingCart.DataLayer.Database.Categories.GetCategories(Nullable`1 parentCategoryID, Boolean active) +443

[Exception: Error getting categories]
   InvertedSoftware.ShoppingCart.DataLayer.Database.Categories.GetCategories(Nullable`1 parentCategoryID, Boolean active) +757
   InvertedSoftware.ShoppingCart.DataLayer.Cache.CacheManager.GetCachedCategories(Nullable`1 parentCategoryID) +189
   UserControls_MenuControl.BindMenu() in e:\Websites\XDEV\XDEV-Templates\Websites\Ecommerce\Website\UserControls\MenuControl.ascx.cs:26
   UserControls_MenuControl.Page_Load(Object sender, EventArgs e) in e:\Websites\XDEV\XDEV-Templates\Websites\Ecommerce\Website\UserControls\MenuControl.ascx.cs:16
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627



Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074

Coordinator
Oct 9, 2009 at 4:51 AM

Please check the connection string. Are you connecting to the correct database?

Oct 11, 2009 at 5:45 AM

here are my connection strings,

 

 

<connectionStrings>
    <add name="StringConnection" connectionString="Data Source=XDEV-AUSTRALIA\SQLExpress;Initial Catalog=XDEVeCommerce;Persist Security Info=True;User ID=xdev;Password=x$xdev$83" providerName="System.Data.SqlClient" />
    <add name="Entities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=XDEV-AUSTRALIA\SQLExpress;Initial Catalog=XDEVeCommerce;Persist Security Info=True;User ID=XDEV;Password=x$xdev$83;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

<connectionStrings>

    <add name="StringConnection" connectionString="Data Source=XDEV-AUSTRALIA\SQLExpress;Initial Catalog=XDEVeCommerce;Persist Security Info=True;User ID=xdev;Password=*******" providerName="System.Data.SqlClient" />

    <add name="Entities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=XDEV-AUSTRALIA\SQLExpress;Initial Catalog=XDEVeCommerce;Persist Security Info=True;User ID=XDEV;Password=*******;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

  </connectionStrings>

 

I ran the sql script on the database and checked it it all looks fine.. except for the exception that is getting thrown

 

Oct 11, 2009 at 1:57 PM

issue has been resolved

Jan 8, 2010 at 6:46 AM

How did you resolve this issue?  I'm seeing the same thing.  I've triple checked my connection strings and database permissions.