Thanks a lot. To explain better the problem in the original version with llbgenPro 2.50 in the DataaccessAdapter this codes overrides CreateselectDQ adding a filter to the query by a field
When we migrates to 5.11 the base member CreateSelectDQ gives an error
**IRetrievalQuery query = base.CreateSelectDQ**
Any idea to replace this code in the new version...
The code that does,t work
*protected override IRetrievalQuery CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects,
IPredicateExpression filter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk,
bool allowDuplicates, IGroupByCollection groupByClause, int pageNumber, int pageSize)
{
IRetrievalQuery query = base.CreateSelectDQ(fieldsToFetch, persistenceInfoObjects, filter, maxNumberOfItemsToReturn, sortClauses, relationsToWalk,
allowDuplicates, groupByClause, pageNumber, pageSize);
// this line of code needs to fbe removed as soon as Microsoft can fix sp_executesql.
// fix the wild card search query performance issue in LLBL by declaring the parameter variables inside of query string.
if (_useNewMethod)
{
query.Command.CommandText = RewriteQuery(query);
}
return query;
}
private string RewriteQuery(IQuery selectQuery)
{
StringBuilder declare = new StringBuilder();
StringBuilder set = new StringBuilder();
foreach (SqlParameter param in selectQuery.Parameters)
{
declare.AppendLine(String.Format("declare {0}_param {1}", param.ParameterName, param.SqlDbType));
// Character columns need the length attached.
if (param.SqlDbType.ToString().IndexOf("CHAR", StringComparison.CurrentCultureIgnoreCase) != -1)
{
declare.Append(String.Format("({0})", param.Size)); //Add character lengths.
declare.AppendLine();
}
set.AppendLine(String.Format("set {0}_param = {0};", param.ParameterName));
}
return String.Format("{0}\r\n{1}\r\n{2}", declare, set, ReplaceVars(selectQuery.Command.CommandText));
}
private string ReplaceVars(string source)
{
Regex reg = new Regex(@"(@[\w|_]+)");
return reg.Replace(source, "$1_param");
}*