sql - SELECT statement with multiple where conditions not running in .NET winform application -


i have complex select query run within winform application. query runs in sql server, times out/short circuits/something when use query in application.

select q.ordnum gisqc..qc_orders q  inner join tod..currentorders new on q.ordnum = new.ordnum  inner join gisqc..cloneorders c on c.newordnum = q.ordnum  inner join tod..currentorders old on c.origordnum = old.ordnum  (q.week = '2015.17') , (new.ordstat = 'c')  , ((new.fldzne in ('c', 'b', 'cx', 'bx', 'x')  , old.fldzne not in ('c', 'b', 'cx', 'bx', 'x'))  or (new.fldzne not in ('c', 'b', 'cx', 'bx', 'x')  , old.fldzne in ('c', 'b', 'cx', 'bx', 'x'))  or (new.fldzne 'a%' , old.fldzne not 'a%')  or (new.fldzne not 'a%' , old.fldzne 'a%')  or (new.fldzne 'v%' , old.fldzne not line 'v%')  or (new.fldzne not 'v%' , old.fldzne 'v%')  or (new.fldzne in ('d', 'non', 'none')  , old.fldzne not in ('d', 'non', 'none'))  or (new.fldzne not in ('d', 'non', 'none')  , old.fldzne in ('d', 'non', 'none'))) 

i cannot create stored procedures in application due server restrictions, has run dynamically. have considered union all i'm unsure syntax.

to clarify, application crashes time call query, have debugged , know issue.

edit

the completed code:

  try         dim test string = "select q.ordnum gisqc..qc_orders q inner join tod..currentorders new on q.ordnum = new.ordnum inner join gisqc..cloneorders c on c.newordnum = q.ordnum inner join tod..currentorders old on c.origordnum = old.ordnum (q.week = '2015.17') , (new.ordstat = 'c') , ((new.fldzne in ('c', 'b', 'cx', 'bx', 'x') , old.fldzne not in ('c', 'b', 'cx', 'bx', 'x')) or (new.fldzne not in ('c', 'b', 'cx', 'bx', 'x') , old.fldzne in ('c', 'b', 'cx', 'bx', 'x')) or (new.fldzne 'a%' , old.fldzne not 'a%') or (new.fldzne not 'a%' , old.fldzne 'a%') or (new.fldzne 'v%' , old.fldzne not line 'v%') or (new.fldzne not 'v%' , old.fldzne 'v%') or (new.fldzne in ('d', 'non', 'none') , old.fldzne not in ('d', 'non', 'none')) or (new.fldzne not in ('d', 'non', 'none') , old.fldzne in ('d', 'non', 'none')))"         dim datest new sqldataadapter(test, me.qc_orderstableadapter1.connection)          dim dstest new dataset          datest.fill(dstest)          me.dgsfha.datasource = dstest.tables(0)      catch ex exception         msgbox("error: " & ex.message)     end try 

the error message is: "error: incorrect syntax near 'line'."

there no issues between 2 databases. when include first 4 conditions of where clause, runs fine. know has complexity of where clause.

(new.fldzne 'v%' , old.fldzne not line 'v%') 

that "not line" should "not like".


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -