Empty Object Or Column Name Error

Posts   
 
    
Ron
User
Posts: 6
Joined: 17-Feb-2009
# Posted on: 17-Feb-2009 22:28:16   

Hi,

I'm trying to execute the following query which produces the SQL below it. I get the error shown at the bottom. I assume it has something to do with the empty brackets but how do I fix it?

Thank You

        Dim q = From at In metaData.Analysis Where at.StrInstrumentId = strInstID _
            And at.StrSampleType.StartsWith("CCALIB_") _
            And at.DtmInjection.Value > dtmBegin _
            And at.DtmInjection.Value < dtmInject _
                 Select at.LngAnalysisId




Query: SELECT [LPLA_1].[lngAnalysisID] AS [LngAnalysisId] FROM [Atlas].[dbo].[tblA2KAnalysis] [LPLA_1]  WHERE ( ( ( ( ( [].[LPFA_2] = @LPFA_21)))))
Parameter: @LPFA_21 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: True.

An exception was caught during the execution of a retrieval query: Cannot use empty object or column names. Use a single space if necessary. Line 1: Incorrect syntax near '.'.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 17-Feb-2009 22:36:02   

Just on a real off chance - it's not something to do with "at" being a keyword somewhere is it? - what happens if you use at1 or something similar...

If not, let us know and we'll take a closer look.

Matt

Ron
User
Posts: 6
Joined: 17-Feb-2009
# Posted on: 17-Feb-2009 22:43:28   

Hi Matt,

I just tried this with same result. By the way I'm using the adapter template and V 2.6 of the software.

        Dim q = From anl In metaData.Analysis Where anl.StrInstrumentId = strInstID _
            And anl.StrSampleType.StartsWith("CCALIB_") _
            And anl.DtmInjection.Value > dtmBegin _
            And anl.DtmInjection.Value < dtmInject _
                 Select anl.LngAnalysisId

Ron

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 17-Feb-2009 22:49:38   

Oh well, just a thought. Can you confirm database, version and driver, and we'll take a closer look.

Thanks

Matt

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 17-Feb-2009 22:55:39   

Does the following thread throw any light on things - seems to be related ? http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=14647

Ron
User
Posts: 6
Joined: 17-Feb-2009
# Posted on: 17-Feb-2009 23:17:50   

Matt,

Thank you very much. THIS works.

        Dim q = From anl In metaData.Analysis Where anl.StrInstrumentId = strInstID _
            AndAlso anl.StrSampleType.StartsWith("CCALIB_") _
            AndAlso anl.DtmInjection.Value > dtmBegin _
            AndAlso anl.DtmInjection.Value < dtmInject _
                 Select anl.LngAnalysisId

It has something to do with the 'And' vs 'AndAlso' logic.

Ron