Solved

Missing operator

Posted on 2013-12-02
8
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Michael Fowler
Michael Fowler 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 11

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
Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

 
LVL 23

Expert Comment

by:Michael Fowler
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 11

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 11

Author Comment

by:HuaMinChen
ID: 39691699
thanks
0

Featured Post

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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