Morning,
If we perform a simple catalog search and set the CatalogSearchOptions
to both return and sort by DisplayName and then run this against a
category on the base catalog it returns all the matches ordered as
expected. If I run the same search against a virtual catalog it throws
a CatalogDatabaseException, "{"Category search failed."}" with
inner exception SqlException, "{"Invalid column name
'DisplayName'."}"- remove the sort and it works - bind the
results to a grid and you can see the DisplayName column is there and
populated.
Is there anyway to sort by DisplayName in a virtual catalog?
Code Snipit:
searchOptions.PropertiesToReturn = "DisplayName";
searchOptions.SortProperty = "DisplayName";
catalogSearch.CategoryName = "My category";
catalogSearch.Recursive = true;
catalogSearch.UseAdvancedFreeTextSearch = true;
catalogSearch.AdvancedFreeTextSearchPhrase = "\"" + searchstuff + "\"";
catalogSearch.SearchOptions = searchOptions;
catalogItemsDataset = catalogSearch.Search(out totalRecords);
Stack Trace:
[SqlException (0x80131904): Invalid column name 'DisplayName'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection) +861578
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) +738774
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
+1959
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) +903
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.ExecuteDbDataReader(CommandBehavior
behavior) +12
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior) +7
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +83
Microsoft.CommerceServer.Catalog.Internal.SqlHelper.ExecuteDataset(SqlConnection
connection, CommandType commandType, String commandText,
CatalogDataSetType catalogDataSetType, SqlParameter[]
commandParameters, String outParameterName, Object& outParameterValue)
+177
Microsoft.CommerceServer.Catalog.Internal.SqlHelper.ExecuteDataset(String
connectionString, CommandType commandType, String commandText,
SqlParameter[] commandParameters, CatalogDataSetType
catalogDataSetType, String outParameterName, Object& outParameterValue)
+121
Microsoft.CommerceServer.Catalog.Internal.SqlHelper.ExecuteDataset(String
connectionString, String spName, Object[] parameterValues,
CatalogDataSetType catalogDataSetType, String outParameterName, Object&
outParameterValue) +101
Microsoft.CommerceServer.Catalog.Internal.SqlHelper.ExecuteDataset(ExecutionContext
executionContext, String spName, Object[] parameterValues,
CatalogDataSetType catalogDataSetType, String outParameterName, Object&
outParameterValue) +211
Microsoft.CommerceServer.Catalog.Internal.Category.Search(CatalogExecutionContext
executionContext, String sqlClause, String ftsPhrase, String
advancedFtsPhrase, String catalogName, String language, String
baseCatalogName, Int32 oid, CatalogSearchOptions searchOptions,
InventoryOptions inventoryOptions, JoinTableInformation jti, Boolean
recursive, Int32& totalRecords, String categoryClause, Object
isVirtualCatalog) +2424
[CatalogDatabaseException: Category search failed.]
Microsoft.CommerceServer.Catalog.Internal.Category.Search(CatalogExecutionContext
executionContext, String sqlClause, String ftsPhrase, String
advancedFtsPhrase, String catalogName, String language, String
baseCatalogName, Int32 oid, CatalogSearchOptions searchOptions,
InventoryOptions inventoryOptions, JoinTableInformation jti, Boolean
recursive, Int32& totalRecords, String categoryClause, Object
isVirtualCatalog) +2692
Microsoft.CommerceServer.Catalog.Internal.Category.Search(CatalogExecutionContext
executionContext, String sqlClause, String ftsPhrase, String
advancedFtsPhrase, String catalogName, String language, String
categoryName, CatalogSearchOptions searchOptions, InventoryOptions
inventoryOptions, JoinTableInformation jti, Boolean recursive, Int32&
totalRecords, String categoryClause) +385
Microsoft.CommerceServer.Catalog.Internal.CatalogSearch.Search(Int32&
totalRecords, Boolean returnTotalRecords) +1369
Microsoft.CommerceServer.Catalog.Internal.CatalogSearch.Search(Int32&
totalRecords) +39
Microsoft.CommerceServer.Catalog.Internal.CatalogServerContextBase.SearchWithCount(CatalogSearchParameters
catalogSearchParameters, CatalogSearchOptions searchOptions,
InventoryOptions inventoryOptions, JoinTableInformation
joinTableInformation, Int32& totalRecords) +207
Microsoft.CommerceServer.Catalog.CatalogSearch.Search(Int32&
totalReco


|