This project has moved and is read-only. For the latest updates, please go here.

Errors when I trying to use the application

Topics: Developer Forum, Project Management Forum, User Forum
Jul 20, 2010 at 5:04 PM
Edited Jul 20, 2010 at 5:41 PM

I have downloaded and compiled the latest changeset and it compiled successfully.
However not sure what do next, so I tried to run the MVC presentation project and I get an error regarding"The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator..".

Error:

[SqlException (0x80131904): The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +86
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
   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.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +443

[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
   System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +479
   System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +736
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +149
   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +44
   ASP.areas_store_views_home_productcategories_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Documents and Settings\rsiva\Desktop\NSK\Baseline\src\ManagedDesigns.Nsk.Web.UI\Areas\Store\Views\Home\ProductCategories.ascx:4
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +56
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060


Does this mean my connection strings are incorrect, if so where do I set this up?
Any instructions on where to start?

Jul 21, 2010 at 2:27 PM

OK it seems the issue is the method GetBestSellingProductCategories and if I comment out the long linq statement then it the page loads now.

However when I click on any of the categories then it throws a wevdev4.0 error, is the application supposed to work because there are errors all over the place or maybe I haven't set it up correctly?

public IEnumerable<ProductCategoryDescriptor> GetBestSellingProductCategories()
        {
            return GetAllProductCategories().OrderBy(c => c.AvailableProductsCount);
            //var descriptors = (from d in
            //                       (from o in this.OrderRepository select o).SelectMany(o => o.Items)
            //                   group d by d.Product.Category into d
            //                   select new
            //                   {
            //                       CategoryId = d.Key.Id,
            //                       CategoryName = d.Key.Name,
            //                       ProductsCount = d.Key.Products.Where(p => p.Category.Id == d.Key.Id).Count(),
            //                       AvailableProductsCount = d.Key.Products.Where(p => p.UnitsInStock > 0).Count(),
            //                       TotalSales = d.Sum(dt => dt.Quantity)
            //                   })
            //                   .OrderByDescending(d => d.TotalSales)
            //                   .Select(
            //                        d => new ProductCategoryDescriptor
            //                        {
            //                            CategoryId = d.CategoryId,
            //                            CategoryName = d.CategoryName,
            //                            ProductsCount = d.ProductsCount,
            //                            AvailableProductsCount = d.AvailableProductsCount
            //                        }
            //                   );
            //return descriptors;
        }

Jul 25, 2010 at 11:40 PM
rsiva wrote:

OK it seems the issue is the method GetBestSellingProductCategories and if I comment out the long linq statement then it the page loads now.

However when I click on any of the categories then it throws a wevdev4.0 error, is the application supposed to work because there are errors all over the place or maybe I haven't set it up correctly?

yep, the application is supposed to work and it actually does on my machine. I'll have a look in order to understand what's wrong; BTW, which DAL are you using: EF or NH?

Jul 26, 2010 at 10:06 AM

Pretty sure. it's EF I'm using however I haven't changed anything since I downloaded the code so it's using the default configuration.