locked
stored procedure that return 2 set of data RRS feed

  • Question

  • User1248258412 posted

    did anyone know how to create the sproc that can return with 2 set of data? below is my sql, but it keep prompt me with error :(

    ALTER

    procedure [dbo].[usp_GetStudName]

    AS

    SET

    NOCOUNT

    ON

    SELECT *

    FROM StudentTbl St, CourseTble Ct

    Where St.courseid = Ct.courseId

    SET

    NOCOUNT OFF

    SELECT

    UserName as FullName

    FROM

    StudentTbl

    WHERE Paid <> '0'

    RETURN

    Monday, April 9, 2012 5:23 AM

Answers

  • User1248258412 posted

    I solve this issue, is my datasource cannot bind 2 set of return.  So, what I do is i create 1 datasource direct bind from the return, the other 1 i create on coding page to get the result.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 10, 2012 1:46 AM

All replies

  • User306743125 posted
    What is the error
    Monday, April 9, 2012 5:29 AM
  • User1248258412 posted

    when i bind it to datasource, for the 1st statement all data can show.

    when come to 2nd statement just now FullName, the error state FullName was not found.

    Monday, April 9, 2012 5:32 AM
  • User306743125 posted
    And you are sure there is a FullName field in the student table? Does it return the correct info when you run only the second query in management studio?
    Monday, April 9, 2012 5:34 AM
  • User1248258412 posted

    yes, it can return value of that.

    but once i bind it to datasource, it will display not found

     

    Monday, April 9, 2012 5:43 AM
  • User306743125 posted
    The sqldatasource only supports one dataset...try objectdatasource or a regular dataset
    Monday, April 9, 2012 5:49 AM
  • User1248258412 posted

    tested but same issue.

    1st sql result can show on the gridview; while the 2nd part just to show FullName keep hit error ''DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'FullName'. ''

     

    Monday, April 9, 2012 5:55 AM
  • User306743125 posted
    I am not sure, may be someone else will chip in, but it might be because both datasets returns the same field name Your error message also refers to the field as a &quot;property&quot; which is not found.
    Monday, April 9, 2012 6:03 AM
  • User1248258412 posted

    I solve this issue, is my datasource cannot bind 2 set of return.  So, what I do is i create 1 datasource direct bind from the return, the other 1 i create on coding page to get the result.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 10, 2012 1:46 AM