Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I have this SP: CREATE 1

Status
Not open for further replies.

loudandclear

Programmer
Oct 1, 2002
3
CA
Hi,

I have this SP:


CREATE Procedure sp_LCInsertSelection

(
@DisplayName varchar(100),
@LetterTypeID Int,
@Directory varchar(150),
@TargetGroupID Int,
@AdminID Int )

As

Insert into LCSelection

(DisplayName, LetterTypeID, Directory, TargetGroupID, AdminID)

Values (@DisplayName, @LetterTypeID, @Directory, @TargetGroupID, @AdminID)

Select 0 as ErrorCode, SelectionID = @@Identity

return
GO

For some reason, I cant reach the returned recordset from ADO, it is always closed. But the data gets inserted all right. I am using ADO 2.6.

What sould I do reach the returned RS ?

Chris
 
Code:
CREATE Procedure sp_LCInsertSelection

    (
        @DisplayName        varchar(100),
        @LetterTypeID        Int,
        @Directory            varchar(150),
        @TargetGroupID        Int,
        @AdminID            Int    )
As    
    set nocount on
    Insert into LCSelection
      (DisplayName, LetterTypeID, Directory, 
       TargetGroupID, AdminID)
    Values (@DisplayName, @LetterTypeID, @Directory, 
            @TargetGroupID, @AdminID)
    Select 0 as ErrorCode, SelectionID = @@Identity
    return
go

The insert statement causes an empty recordset to be returned unless set nocount on is included
 
I am not sure as to what can be the reason for your record set being empty, but i suspect that the return key word you put after your select statement may be the reason.I hope you understand the implication of using the return keyword in a stored procedure., do not use it if not needed, in your case you are not returning anything so what is the point of using it if the next line that follow signals the end of the stored procedure,Remove the return keyword and try again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top