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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Item cannot be found 1

Status
Not open for further replies.

robinsql

Programmer
Aug 2, 2002
236
0
0
IE
Hi,

I keep getting the following error when I get to the second line of the code beneath...
Item cannot be found in the collection corresponding to the requested name or ordinal.

sSQL = "EXEC sp_SaveCapex " params listed.
Set rsProposalNo = g_Conn.Execute(sSQL)
g_iProposalNo = rsProposalNo.Fields("Record")

CREATE PROCEDURE sp_SaveCapex
(
Params
)
AS
INSERT INTO CAPEX
(
Columns listed
)
VALUES
(
Values listed
)

SELECT @@identity AS Record
GO

The insert works fine and if I run the stored proc in query analyzer, it returns the value I require. However, when I run it in VB I get the error.

Anyone know what's going on?

Thanks for any help,
Robin
 
Using execute to return a recordset returns a closed recordset because the first statement does not return any rows. Make these change to fix

CREATE PROCEDURE sp_SaveCapex
(
Params
)
AS

SET NOCOUNT ON

INSERT INTO CAPEX
(
Columns listed
)
VALUES
(
Values listed
)

SET NOCOUNT OFF

SELECT @@identity AS Record
GO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top