Solved

Missing operator

Posted on 2013-12-02
8
359 Views
Last Modified: 2013-12-02
Hi,
I get this error

Server Error in '/App18_devst' Application.

Syntax error (missing operator) in query expression 'iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy') [feat8_dt],[feat7],[feat9],[feat10],[obj4_fullname],[obj4_name],[feat11],[feat12],[feat13_dt] as [col_feat13_dt], [feat14_dt] as [col_feat14_dt] FROM [ite_tab] where [ite_abbr]=@par_id'.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

 Exception Details: System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression 'iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy') [feat8_dt],[feat7],[feat9],[feat10],[obj4_fullname],[obj4_name],[feat11],[feat12],[feat13_dt] as [col_feat13_dt], [feat14_dt] as [col_feat14_dt] FROM [ite_tab] where [ite_abbr]=@par_id'.

Source Error:


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:



[OleDbException (0x80040e14): Syntax error (missing operator) in query expression 'iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy') [feat8_dt],[feat7],[feat9],[feat10],[obj4_fullname],[obj4_name],[feat11],[feat12],[feat13_dt] as [col_feat13_dt], [feat14_dt] as [col_feat14_dt] FROM [ite_tab] where [ite_abbr]=@par_id'.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1844461
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +398
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +243
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +280
   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +264
   App18._Default.refresh_pg() +4475
   App18._Default.Pfeat9_Load(Object sender, EventArgs e) +724
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Pfeat9.ProcessRequestMain(Boolean includeStfeat9sBeforeAsyncPoint, Boolean includeStfeat9sAfterAsyncPoint) +3178

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408  

due to this line. why?
                OleDbCommand cmd = new OleDbCommand("SELECT top 1 [ite_id],[ite_abbr],[ite_name],[ite_feat],[obj2_id],[obj3_id],[ent_id],[ent_feat2_id],[ent_title_id],[feat3],[feat4],[feat5],[feat6],[feat7],iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy') [feat8_dt],[feat7],[feat9],[feat10],[obj4_fullname],[obj4_name],[feat11],[feat12],[feat13_dt] as [col_feat13_dt], [feat14_dt] as [col_feat14_dt] FROM [ite_tab] where [ite_abbr]=@par_id and [ite_feat]=@par_feat", conn);

Open in new window

0
Comment
Question by:HuaMinChen
  • 3
  • 3
  • 2
8 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 39691639
You maybe missing a comma between these two expression in the iif and a closing brace?

,format([feat8_dt],'dd-mm-yyyy') [feat8_dt],
0
 
LVL 23

Assisted Solution

by:Michael74
Michael74 earned 67 total points
ID: 39691642
looks like you are missing a closing brace to close the iif statement

'iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy') [feat8_dt],[feat7],[feat9],[feat10],[obj4_fullname],[obj4_name],[feat11],[feat12],[feat13_dt] as [col_feat13_dt], [feat14_dt] as [col_feat14_dt] FROM [ite_tab] where [ite_abbr]=@par_id)'

Open in new window

0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 39691653
Sorry, I still get the same error with this line.
                OleDbCommand cmd = new OleDbCommand("SELECT top 1 [ite_id],[ite_abbr],[ite_name],[ite_feat],[obj2_id],[obj3_id],[ent_id],[ent_feat2_id],[ent_title_id],[feat3],[feat4],[feat5],[feat6],[feat7],iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy')) [feat8_dt],[feat7],[feat9],[feat10],[obj4_fullname],[obj4_name],[feat11],[feat12],[feat13_dt] as [col_feat13_dt], [feat14_dt] as [col_feat14_dt] FROM [ite_tab] where [ite_abbr]=@par_id and [ite_feat]=@par_feat", conn);

Open in new window

0
 
LVL 23

Expert Comment

by:Michael74
ID: 39691670
You are missing a closing brace for the iif statement. Try this

                OleDbCommand cmd = new OleDbCommand("SELECT top 1 [ite_id],[ite_abbr],[ite_name],[ite_feat],[obj2_id],[obj3_id],[ent_id],[ent_feat2_id],[ent_title_id],[feat3],[feat4],[feat5],[feat6],[feat7],iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy')),[feat7],[feat9],[feat10],[obj4_fullname],[obj4_name],[feat11],[feat12],[feat13_dt] as [col_feat13_dt], [feat14_dt] as [col_feat14_dt] FROM [ite_tab] where [ite_abbr]=@par_id and [ite_feat]=@par_feat", conn); 

Open in new window

0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 29

Expert Comment

by:Paul Jackson
ID: 39691672
You're still missing a comma after the closing brace you put in as far as I can see
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 39691682
Are you all talking about this?

iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy')) [feat8_dt],...

Open in new window

what is missing above?
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 68 total points
ID: 39691688
a comma after the iif function call:

iif(isnull([feat8_dt]),'',format([feat8_dt],'dd-mm-yyyy')), [feat8_dt],...
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 39691699
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now