Stored procedure with JOIN result and LINQ
-
I am using stored procedure, which returns the records from two tables by INNER JOIN. In Visual Studion 2008, using ORM I dragged the stored procedure from Server Explorer. Inside the aspx page I am using ObjectDataSource with type name of datacontext and select method of stored procedure. I bound the Repeater control to object data source and everything is working fine. Results are coming and displayed properly. I ran into problem, when I tried to display the contents of one column <%# Eval("DetailPage")%>, which belongs to the 2nd table of JOIN (Sections) inside the stored procedure. The exception
DataBinding: 'storedprocedurename' does not contain a property with the name 'DetailPage'
while all other columns from 1st table(Articles) in join are accessable. Logically, its not matter of LINQ to know from where data is retrieved; i.e. from single table or multiple tables, because LINQ is calling stored procedure. If completly no record is returned, then can be said may be there is something missing and records are not returned. Records are coming, just a few columns are missing!! how come? I tried to execute the same stored procedure in Sql Server by passing exact parameters and same records are displayed with columns including other joined table. values also exist in these columns, then where is the problem? Following is the stored procedure's querySELECT Articles.ID, Articles.SectionID, Articles.Title, Articles.Contents, Articles.Author, Sections.HomePage, Sections.DetailPage,ROW_NUMBER() OVER (ORDER BY Articles.Sequence DESC) AS SNo FROM Articles INNER JOIN Sections ON Articles.SectionID=Sections.ID WHERE Articles.SectionID=11
All columns from Articles table are accessable but no one column from Sections table accessable. Try to access in repeater control throws the exception mentioned above. Does anyone can figure what and where is the problem ? Environment --------------- Sql Server 2005 VS 2008 RTM .NET 3.5 I need URGENT help.Regards Aftab Sindhi .NET Application Developer U.A.E