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

Cannot open recordset when doing an insert and select in procedure

Status
Not open for further replies.

bryant89

Programmer
Nov 23, 2000
150
CA
I have done many dtc recordsets using a select query(stored procedure) that work fine. but in this particular case I am doing an insert and a select. And when I try to open the recordset I get an error.

The error just tells me there was an error in the recordset.asp line 636 which is the line to open it. So for some reason the recordset will not open. I have set the rights the same as for other tables and stored procedures that work so I know it isnt a rights problem. I think it is because of a parameters problem, I am not sure. On the onclick event for my button I set the parameters and then I open the recordset. I tried opening the recordset first and then setting the parameters but that didnt work so I tried this. And this doesnt work either. Her is my current code for my button click:

Sub btnNext_onclick()

'purpose: set the parameters for the recordset

dim name,addr,city,prov,coun,estc,stat

name=txtName.value
addr=txtAddr.value
city=txtCity.value
prov=txtProv.value
coun=txtCountry.value
estc=txtEstCost.value
stat=txtStatus.value


rcsContProj.setParameter 1,name
rcsContProj.setParameter 2,addr
rcsContProj.setParameter 3,city
rcsContProj.setParameter 4,prov
rcsContProj.setParameter 5,coun
rcsContProj.setParameter 6,estc
rcsContProj.setParameter 7,stat

rcsContProj.open

backNextFin1 rcsContProj,frmContProjDescription

rcsContProj.close
End Sub



I should mention that my recordset rcsContProj accesses a stored procedure that does an insert and a select. The code for the stored procedure is this:


Alter Procedure stpCreateReturn
(
@copName varchar(70),
@copCity varchar(40),
@copProv char(2),
@copCountry varchar(30),
@copAddress varchar(70),
@copStatus varchar(70),
@copEstCost int
)
AS

DECLARE @copID int

set nocount on

INSERT INTO tblContProj (copName, copCity, copProv, copCountry, copAddress, copStatus, copEstCost)
VALUES (@copName, @copCity, @copProv, @copCountry, @copAddress, @copStatus, @copEstCost)

SET @copID = @@IDENTITY
SELECT @copID as copID

return


Any suggestions would be greatly appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top