Solved

Missing operator

Posted on 2013-12-02
8
363 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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
 
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

726 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