Jagz S
Jagz S

Reputation: 907

Unable to create a constant value of type 'System.Object'. Only primitive types ('such as Int32,

Can any one tell me whats wrong in this query

var result = from m in _ftsDataContext.SubCategories 
             join n in _ftsDataContext.Categories
             on m.CategoryID equals n.CategoryID
             select new {
                 SubCategoryID = m.SubCategoryID,
                 Name = n.CategoryName + ' ' + m.SubCategoryName
             };

i m getting this error : Unable to create a constant value of type System.Object. Only primitive types (such as Int32, String, and Guid) are supported in this context

Upvotes: 1

Views: 712

Answers (1)

Massimo Zerbini
Massimo Zerbini

Reputation: 3191

Try with " " :

Name = n.CategoryName + " " + m.SubCategoryName 

Upvotes: 2

Related Questions