SQL Server stored procedure returning correct number of rows, but all rows are the same -


Not sure where the problem is ... I have a stored procedure that is written (when SQL Server MGMT ) I hope to see return results:

  USE [DataViewer] Go / ****** Object: Archived Procurrier [DBO]. [DV_GetPSCTreeNodes] Script Date: 08/10/2014 1: 48:03 PM ****** / SET ANSI_NULLS Go on set at QUOTED_IDENTIFI - ================= ============================ - Author: & lt; me! & Gt; - Description: & lt; Used by data viewer GUI & Gt; - ============================================= OPTIONAL PROCESS [Dbo ]. [DV_GetPSCTreeNodes] - Add parameters to the stored procedure here @ iNodeLevel int, @iParentNodeId Note on the Start button as bigint; DECLARE @sQuery varchar (2000) IF @INodeLevel & gt; = 5 Returns Else - Insert the statement for the process here: VARCHAR (10)) as the SET @sql = 'SELECT * FROM DataView.dbo.v_Tree WHERE L' + CAST ((iNodeLevel + 1) + 'ID net and L VARCHAR (10)) EXEC (@squo) END   

as VARCHAR (10)) + 'id =' + (cast) (as the iNodeLevel) As I mentioned, if I run it in SMSS, then I get the desired results.

However, if I run it through this service, then I get the correct amount of record back, but they are all duplicates of the first line (and I can see the table and find out that I Getting duplicates). If I try new parameters and return 15 different lines in SSMS, then my webpage will show 15 rows of row 1 data that is repeated.

Here's a call from my client:

  from the list & lt; V_PowerSystemCIMTree & gt; List = null; DVServiceClient Proxy = New DVServiceClient (); Try {list = proxy.DV_GETPSCTreeNodes (2,325550) .toList (); // 2 and 325550 are only hardcodes // to check if this is working} CATCH (Exception pre) {console. WrightLine (ex.GetType (.) FullName); Console.WriteLine (ex.Message); } Finally {Proxy. Close (); } View return (list);   

which calls my service:

  Read only datawiretextures _Context = new datatype (); Public listing & lt; DataViewer_DAL.v_PowerSystemCIMTree & gt; DV_GetPSCTree nodes (int firstpalm, long seconds) {return _Context.DV_GetPSCTreeNodes (firstmost, second param). Olist (); }   

Why do I have to be set in a result management studio, but repeated data on my webpage?

If EF reads a second line from the view that contains same unit key (all The same value in non-empty columns), then the first row will be read already - this is not no second SH will look at the columns ....

So you only need to add the primary key for the underlying table (O) in the viewing column, EF data model clearly Define a "unit" to see, or you need to add your artificial, unique columns (such as ROW_NUMBER () ) and make sure it is unnecessary and thus EF "derived "Part of the unit key

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -