Note that there are some explanatory texts on larger screens.

plurals
  1. POMissing operand before 'And' operator, but rendering page
    text
    copied!<p>I have a page which is throwing Missing operand before 'And' operator error on this code:</p> <pre><code>string filtre = (Request["pn"] == "Tous" ? "pn=pn" : "pn='" + Request["pn"] + "'"); filtre += (Request["dep"] == "Tous" ? "" : " and erreur=" + Request["dep"]); filtre += (Request["err"] == "Tous" ? "" : " and reference=" + Request["err"]); filtre += (Request["comp"] == "Tous" ? "" : " and compagnie='" + Request["comp"] + "'"); filtre += (Request["prob"] == "on" ? " and not reference=58" : ""); StringBuilder tbltxt = new StringBuilder(); foreach (DataRow ligne in Datatbl.Tables["ins"].Select(filtre, (Request["tridep"] == "on" ? "erreur" : "datecr"))) </code></pre> <p>The foreach line is throowing this error.</p> <p>Even with this error the page gets rendered correctly. It is just annoying to get this error by e-mail even thogh the user did not get an error page.</p> <p>Can someone help me with this?</p> <p>Thank you</p> <p>EDIT:</p> <p>1- This code generates an Excel sheet</p> <p>2- Not all computers that loads the page generates this error</p> <p>3- The Excel we use is Excel 2010</p> <p>4- It throws this error 3 times every time time the error is generated</p> <p>Here is the complete error message:</p> <p>Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.</p> <p>System.Data.SyntaxErrorException: Syntax error: Missing operand before 'And' operator. System.Data.ExpressionParser.Parse() System.Data.DataExpression..ctor(DataTable table, String expression, Type type) System.Data.Select..ctor(DataTable table, String filterExpression, String sort, DataViewRowState recordStates) System.Data.DataTable.Select(String filterExpression, String sort) inspectionrapport.fonctions.Page_Load() in c:\Projets\Intranet\Timesheets\Timesheets\Rapports\insptest\inspectionrapport.aspx.cs:line 45 System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload