Sybase SQL-Anywhere / Error on a Linq-Query with more then one where-clauses

Posts   
 
    
lsommer
User
Posts: 12
Joined: 16-Mar-2012
# Posted on: 05-Apr-2013 21:17:49   

LLBLGEN-Version: 3.5.12.123

Database: Sybase SQL Anywhere 12.01 (12.0.1.3867 (32-bit))

A query with one where-Clause works fine. If using more than one where-clauses, an error occurs.

Here is a simple VB.NET-Sample

Dim schema As New LinqMetaData()

// this works Dim q = From c In schema.Banken Where (c.ORT = "XXX") Select c

// does not work Dim q = From c In schema.Banken Where (c.ORT = "XXX" And c.BLZF = "1") Select c

Error-Message:

SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException wurde nicht behandelt. Message=An exception was caught during the execution of a retrieval query: Syntaxfehler bei '.' in Zeile 1. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. QueryExecuted= Query: SELECT [LPA_L1].[BLZ], [LPA_L1].[BLZF], [LPA_L1].[NAME], [LPA_L1].[PLZ], [LPA_L1].[ORT], [LPA_L1].[KBEZ], [LPA_L1].[PAN], [LPA_L1].[BIC], [LPA_L1].[PZM], [LPA_L1].[LFNR], [LPA_L1].[AEKZ], [LPA_L1].[HBBLZ], [LPA_L1].[NFBLZ] FROM [VBuser].[Banken] [LPA_L1] WHERE ( ( ( ( .[LPFA_1] = ?)))) ORDER BY [LPA_L1].[BLZ] ASC

RuntimeBuild=07122012 RuntimeVersion=3.5.0.0 Source=SD.LLBLGen.Pro.ORMSupportClasses.NET20 StackTrace: bei SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior) bei SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, ITransaction containingTransaction, IEntityCollection collectionToFill, Boolean allowDuplicates, IEntityFields fieldsUsedForQuery, IFieldPersistenceInfo[] fieldPersistenceInfos) bei SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.PerformGetMultiAction(ITransaction containingTransaction, IEntityCollection collectionToFill, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) bei SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.GetMulti(ITransaction containingTransaction, IEntityCollection collectionToFill, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IPredicate selectFilter, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) bei SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) bei SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider.ExecuteEntityProjection(QueryExpression toExecute) bei SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression) bei SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression) bei SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute(Expression expression) bei SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery1.Execute() bei SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.SD.LLBLGen.Pro.LinqSupportClasses.ILLBLGenProQuery.ExecuteTResult bei TestLLBLGEN.Form1.Vorbelegung() in F:\Henke\ew.net\TestLLBLGEN\Form1.vb:Zeile 122. bei TestLLBLGEN.Form1.Form1_Load(Object sender, EventArgs e) in F:\Henke\ew.net\TestLLBLGEN\Form1.vb:Zeile 18. bei System.Windows.Forms.Form.OnLoad(EventArgs e) bei System.Windows.Forms.Form.OnCreateControl() bei System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) bei System.Windows.Forms.Control.CreateControl() bei System.Windows.Forms.Control.WmShowWindow(Message& m) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.ScrollableControl.WndProc(Message& m) bei System.Windows.Forms.Form.WmShowWindow(Message& m) bei System.Windows.Forms.Form.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) bei System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow) bei System.Windows.Forms.Control.SetVisibleCore(Boolean value) bei System.Windows.Forms.Form.SetVisibleCore(Boolean value) bei System.Windows.Forms.Control.set_Visible(Boolean value) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.Run(Form mainForm) bei TestLLBLGEN.Form1.Main() in F:\Henke\ew.net\TestLLBLGEN\Form1.Designer.vb:Zeile 0. InnerException: iAnywhere.Data.SQLAnywhere.SAException ErrorCode=-2147467259 Message=Syntaxfehler bei '.' in Zeile 1 NativeError=-131 Source=SQL Anywhere .NET Data Provider StackTrace: bei iAnywhere.Data.SQLAnywhere.SACommand._ExecuteReader(CommandBehavior commandBehavior, Boolean isExecuteScalar, Boolean isBeginExecuteReader) bei iAnywhere.Data.SQLAnywhere.SACommand.ExecuteDbDataReader(CommandBehavior behavior) bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) bei SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior) InnerException:


Is there anybody, who can help us?

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Apr-2013 07:57:50   

Use AndAlso, not And. And will result in a bitwise and in the Expression tree and it's not possible to detect the real meaning. Ref: http://llblgen.com/TinyForum/Messages.aspx?ThreadID=15406

David Elizondo | LLBLGen Support Team
lsommer
User
Posts: 12
Joined: 16-Mar-2012
# Posted on: 06-Apr-2013 08:26:39   

the problem no longer exists. Thank you very much, "daelmo".