I have the following query:; with tblASmax as( select serialnumber, runlocal,process,result,datein,operatorid from ( select serialnumber,datein,runlocal,process,result,operatorid, row_no = row_number() over (partition by process,serialnumber order by runlocal desc) from tblFA ) m where m.row_no = 1 and process = '12'),cte AS( select productiono,partcode, serial = firstsr, lastsr from tblpo where productiono = '5009486' union all select productiono,partcode, serial = serial + 1, lastsr from cte where serial + 1 <= lastsr)select cte.productiono,partcode,datein,cte.serial,result,operatoridFROM tblasmax right JOIN cte ON cte.serial = tblasmax.serialnumber order by serialoption (MAXRECURSION 10000)
This query works fine in MS SQL Server Management Studio, But When I run this in visual studio 2008 in a webform in gridview, it gives error. screenshot is here: [url]http://postimage.org/image/1i0n9f0dg/[/url]Please help..