Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-29 : 09:38:04
|
| Ergin writes "Hi,i need to get the last record id after i insert to tableI have created the following stored procedureCREATE PROCEDURE sp_test @cid int, @cname varchar(15) AS insert into tCity (tCityID,CityName) VALUES (@cid,@cname) select a1=max(tCityID) from tCity if i execute this sp in Query Analyser it works well and gives me the last record idBut the problem is:If i call this sp whithin the ASP script with the following code SQL="EXEC sp_test 35,'ALASKA'" set myRS=dbx.execute(SQL) lastrecord=myRS("a1")it gives me the following error;Error Type: ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal. I could not solve it yet..Thanks" |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2002-03-29 : 09:38:04
|
| Try SET NOCOUNT ON at the beginning of your proc. |
 |
|
|
|
|
|