Syntax error when using ternary operator

Stimulsoft Reports.WEB discussion
Post Reply
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Syntax error when using ternary operator

Post by TestBoy »

Consider the following query:

Select * from foo where bar = 'asdf' {@param != 0 ? "and foo.column=@param" : ""}

When I use such a query in the datasource editor it doesn't like it. Trying to run the query results in a syntax error.
I can hit continue on the exception window and ignore it then preview the report.
Report works as expected but only in the designer.

Put the report on the webserver, run the report... and I get a dialog that says... Parser error: Syntax error.
Same error as presented in the designer when I try to run the query from the datasource editor.
So the report works on the desktop but not on the web.
Removing the ternary operator and everything works fine.

But I need the ternary operation....


One exception is as follows:

Code: Select all

----------------------------
[Customer Explanation]



----------------------------
[General Info]

Application: Stimulsoft Reports
Framework:   v4.0.30319
Version:     Version: 2020.1.1 from 19 December 2019
MachineName: DESKTOP-PMJ1S6U
OSVersion:   Microsoft Windows NT 6.2.9200.0
UserName:    Mark

----------------------------
[Exception Info]
Message:     Parser error: Syntax error

Source:      Stimulsoft.Report

StackTrace:
   at Stimulsoft.Report.Engine.StiParser.ParseTextValue(String inputExpression, StiComponent component, Object sender, StiParserParameters parameters)
   at Stimulsoft.Report.Engine.StiParser.ParseTextValue(String inputExpression, StiComponent component, Object sender, Boolean& storeToPrint, Boolean executeIfStoreToPrint, Boolean returnAsmList)
   at Stimulsoft.Report.Dictionary.Design.StiSqlExpressionsForm.GetExpressionResult(String exp2)
   at Stimulsoft.Report.Dictionary.Design.StiSqlExpressionsForm..ctor(StiSqlSource source, List`1 exps, StiReport report)
   at Stimulsoft.Report.Dictionary.Design.StiDataStoreSourceEditForm.ButtonRunScript_Click(Object sender, EventArgs e)

----------------------------
[Assemblies]
mscorlib, Version = 4.0.0.0
Stimulsoft.Base, Version = 2020.1.1.0
Stimulsoft.Report, Version = 2020.1.1.0
Stimulsoft.Report.Design, Version = 2020.1.1.0
Stimulsoft.Report.Import, Version = 2020.1.1.0
Stimulsoft.Report.Win, Version = 2020.1.1.0
System.Data, Version = 4.0.0.0
System.Windows.Forms, Version = 4.0.0.0
WindowsBase, Version = 4.0.0.0

Exception is thrown in the designer when I hit retrieve columns:

Code: Select all

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
Stimulsoft.Report.Engine.StiParser+StiParserException: Parser error: Syntax error
   at Stimulsoft.Report.Engine.StiParser.ParseTextValue(String inputExpression, StiComponent component, Object sender, StiParserParameters parameters)
   at Stimulsoft.Report.Engine.StiParser.ParseTextValue(String inputExpression, StiComponent component, Object sender, Boolean& storeToPrint, Boolean executeIfStoreToPrint, Boolean returnAsmList)
   at Stimulsoft.Report.Dictionary.Design.StiSqlExpressionsForm.GetExpressionResult(String exp2)
   at Stimulsoft.Report.Dictionary.Design.StiSqlExpressionsForm..ctor(StiSqlSource source, List`1 exps, StiReport report)
   at Stimulsoft.Report.Dictionary.Design.StiDataStoreSourceEditForm.ButtonRetrieveColumns_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at Stimulsoft.Controls.StiToolButton.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at Stimulsoft.Controls.StiToolButton.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
Designer
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Designer.exe
----------------------------------------
Stimulsoft.Report
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Report.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4150.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Stimulsoft.Base
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Base.DLL
----------------------------------------
Stimulsoft.Report.Win
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Report.Win.DLL
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4121.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Stimulsoft.Wizard.Wpf
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Wizard.Wpf.DLL
----------------------------------------
Stimulsoft.Dashboard
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Dashboard.DLL
----------------------------------------
Stimulsoft.Report.WpfDesign
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Report.WpfDesign.DLL
----------------------------------------
Stimulsoft.Accounts.Wpf
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Accounts.Wpf.DLL
----------------------------------------
Stimulsoft.Data
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Data.DLL
----------------------------------------
Stimulsoft.Report.Design
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Report.Design.DLL
----------------------------------------
Stimulsoft.Controls.Win
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Controls.Win.DLL
----------------------------------------
Stimulsoft.Controls
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Controls.DLL
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Stimulsoft.Report.Check
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Report.Check.DLL
----------------------------------------
Stimulsoft.Report.Helper
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Report.Helper.DLL
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
Stimulsoft.Server.Connect
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Server.Connect.DLL
----------------------------------------
Stimulsoft.Server.Objects
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Server.Objects.DLL
----------------------------------------
WindowsFormsIntegration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4150.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsFormsIntegration/v4.0_4.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
PresentationCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
WindowsBase
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
PresentationFramework
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
System.Xaml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
----------------------------------------
PresentationFramework.Aero2
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero2/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero2.dll
----------------------------------------
Stimulsoft.Report.Wpf
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Report.Wpf.DLL
----------------------------------------
PresentationFramework-SystemXmlLinq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXmlLinq/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXmlLinq.dll
----------------------------------------
PresentationFramework-SystemXml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXml/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXml.dll
----------------------------------------
Microsoft.CSharp
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
----------------------------------------
System.Dynamic
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
UIAutomationTypes
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationTypes/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll
----------------------------------------
UIAutomationProvider
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4180.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationProvider/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
----------------------------------------
MySql.Data
    Assembly Version: 6.9.9.0
    Win32 Version: 6.9.9.0
    CodeBase: file:///C:/Users/Mark/AppData/Local/Stimulsoft/DataAdapters/MySql.Data/MySql.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.Design
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Design/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
Stimulsoft.Editor
    Assembly Version: 2020.1.1.0
    Win32 Version: 2020.1.1.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Designer%202020.1.1/Stimulsoft.Editor.DLL
----------------------------------------
System.EnterpriseServices
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
System.Management
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.3752.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
xkfl1nby
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
j3fze3jf
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
1ypk2hay
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
41tm4wi0
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
34r5124y
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
1owvcnyo
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
tseffxfn
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
nu2gu1x5
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
i1geamxs
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
iv350pas
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
hw123zh2
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
k3ec1pof
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
oxp3qa25
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
jnsvspt5
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
hrfdvohr
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
x4yhzb1d
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.




Lech Kulikowski
Posts: 7295
Joined: Tue Mar 20, 2018 5:34 am

Re: Syntax error when using ternary operator

Post by Lech Kulikowski »

Hello,

It is not possible to use combination of the ternary operator, parameters, and expression in the SQL query.
You can use the following query:
select * from Categories where CategoryID > 0 and (@p1 = '' OR CategoryName = @p1)

Thank you.
Attachments
sample1.mrt
(7.01 KiB) Downloaded 158 times
sample2.mrt
(6.74 KiB) Downloaded 152 times
Annotation 2020-05-22 103405.png
Annotation 2020-05-22 103405.png (113.91 KiB) Viewed 6790 times
Post Reply