SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development
View Poll Results: Am I being a moron?
Yes 1 100.00%
No 0 0%
Voters: 1. You may not vote on this poll


Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 6th, 2003, 06:21 AM
drpeck drpeck is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 drpeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs down ASP recordset annoyance

OK I have been running a piece of ASP quite satisfactorily on a server, and now I have moved it to a new .net enabled server it has broken. Basically I am running a stored procedure that performs an update and then Selects the ID of the updated record.

However on the .net server the record set doesn't appear to have the select statements result in it.

As I said before this code DOES work on another server. Please find the code below:

--------------------------------
MSSQL: Stored Procedure
--------------------------------

CREATE PROCEDURE addHBHouse
@NAME varchar(255),
@EFF int,
@COST int
AS
INSERT INTO HBHouses (name, efficiency, cost, uploaded, uploader)
VALUES (@NAME, @EFF, @COST, GetDate(), 'Anonymous')
SELECT @@IDENTITY AS newHouse
GO

--------------------------
ASP Code: "VBScript"
--------------------------

set connection=server.createObject("adodb.connection")
connection.open ****Connection String*****
set answer = connection.execute("EXEC addHBHouse '"& name & "', " & eff & ", " & cost
ID = answer("newHouse")

--------------------------

And it claims on the "ID =" line:

'ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.'



If I remove the SELECT @@IDENTITY from the stored procedure and add it as another query then it works fine, but I need a solution that doesn't require me putting ALL my stored procedures into single queries

A little help please someone?

Thanks

Last edited by drpeck : November 6th, 2003 at 06:24 AM.

Reply With Quote
  #2  
Old November 6th, 2003, 06:36 AM
drpeck drpeck is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 drpeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Its possibly worth mentioning that when I use the Query Analyser it DOES return a field called newHouse with one record in it.

Reply With Quote
  #3  
Old November 6th, 2003, 08:50 AM
drpeck drpeck is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 drpeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I know the answer!!!

Horray!

After a whole morning of searching I have come back from Lunch to find the solution.

URL

Horray for Ken!

BTW, I am now voting yes in my poll

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > ASP recordset annoyance


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway