c# - OleDbDataReader query syntax error in asp.net -


I am trying to execute a query that separates the separate database from OleDbDataReader, but in the query string Error getting, note that this query is correct and successfully running in SQL Studio Manager but in the net I get this error

  OleDbDataReader reader = myCommand.ExecuteReader ();   

Error message:

Wrong syntax near 'PR1'

My code is "long query string"

  protected zero page_load (object sender, event aRGS) {string stroke string = system. Configuration. Configuration Manager. Connection strings ["Workflow"]. ConnectionString.ToString (); String sqlstr = "Selection Collages (Angghier, 'Total') [Angdier]," + "SUM (in case when ASTAT = 'distributed' then the second second end) [Delayed]," + "SUM (full) "SUM" (case when a.Status = 'pending' then total second zero) as [pending], "+" SUM (case when (whole) a.Status = 'Rejected') then total zero ) [Disclaimed], "+" as the total number (+) as "+" in the form of COUNT (*), CurrentActorUID, ReferenceNo, Status, RequestedDate from tbl_ServiceTracking "+" where CurrentActorUID is empty Is not present and UID << "and" + "(condition = 'Disapproved' or condition = 'full' or 'condition' = 'pending' or condition = 'distributed') and (not service null)" + "group, A "+" JOIN PR1.dbo.GetUserDetailsE as a current entity uid by the present entity UID, the current unit.U.D. printers name "+" where - B.DrCD == Dicrod " + "(CAST (A. Request Date DATETIME) & gt; = '1/1/2014' and Cast (A.DATETIME as requested date) & lt; = '4/30/2014')" + "Group B If Bengdir "+" rollup not tap or grouping with Having Anjider (Biaanjeediaiar) = 1 order "+ Bi.ajeediaiar tap the 1 ELSE 0 END, Bi.a.jikdir" by when "; Olebey Binconnection myConnection = New Oleandbox (stroke string); Try {myConnection.Open ();} hold (exception mistake) {System.Diagnostics.Debug.WriteLine (err.Message); } OleDbCommand myCommand = new OleDbCommand (sqlstr, myConnection); OleDbDataReader Reader = myCommand.ExecuteReader (); myCommand.ExecuteReader (CommandBehavior.CloseConnection); Chart 1 DataBundCrossable (reader, "excellent", "satisfied", "not satisfactory", "total"); }   

Any suggestions?

You've lost a place here:

  "By current ICU Group, status, requested date, not reference) should be a "+   

:

 " group Additionally, instead of using the inclusion '@ 'String' sqlstr = @ "SELECT COALESCE (engdir, 'total') [angrier], Sm (case when a.Status = 'distributed' then total second 0 end) [distributed], SUM (case when a.Status = 'complete' In the form of [full] at the end [full], SUM (case when a.Status = 'pending' then the total remaining end) [pending], SUM (case when (a.Status = 'Rejected') then total other Void) as the total number (*) counted (*) as total (*) count, *,,,,,,,,,,,,, tbl_ServiceTracking from the current date, the CurrentActorUID is not blank and CurrentActorUID & lt; '' And JOIN PR1 .dbo.g etUserDetailsE AA at present. Current unit UID = B. Peruser name WHERE - B. DICRDEDER 0 DartCode (CAST (A.Ruginated Debt Asset Date) and gt; = '1/1/2014' and Cast (A.Ruginated Debt Asset Date) and Lieutenant; = '4/30/2014') Group by BONGR With rollup hovering engineer faucet or grouping (BANGDIR) = 1 in the case of order when the BGDIR faucet then 1 ELSE 0 END, BANGDR ";   

query Run in your SQL platform and from there you can easily check where the error came from Land. And just write the string @ "";

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -